Skip to content

Commit

Permalink
added for on-out-event
Browse files Browse the repository at this point in the history
  • Loading branch information
ortexx committed Mar 28, 2018
1 parent dfc4fff commit 47c21aa
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 38 deletions.
20 changes: 10 additions & 10 deletions dist/akili.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/akili.min.js

Large diffs are not rendered by default.

17 changes: 1 addition & 16 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "akili",
"version": "0.6.2",
"version": "0.6.3",
"description": "Akili - javascript framework",
"main": "./src/akili.js",
"author": {
Expand Down
3 changes: 1 addition & 2 deletions src/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export default class Component {
keys.push(key);
vars.push(globals[key]);
}

return new Function(...keys, `${exps.join('; ')}`).apply(context, vars);
}

Expand Down Expand Up @@ -137,7 +137,6 @@ export default class Component {

if (child.nodeType == 3) {
this.__initializeNode(child, parent);

child.nodeValue = this.__evaluate(child);
}
else if (child.nodeType == 1 && !child.__akili) {
Expand Down
5 changes: 3 additions & 2 deletions src/components/for.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import utils from '../utils.js';
*/
export default class For extends Component {
static matches = '[in]';
static events = ['out'];
static saveAttributeProxyIn = true;

static define() {
Expand Down Expand Up @@ -150,12 +151,10 @@ export default class For extends Component {
}

this.data = data;
let iterators = [];
let index = 0;

const loop = (key, value, index) => {
let iterator = this.loop(key, value, index);
iterators.push(iterator);
iterator.iterate(index);
};

Expand All @@ -180,6 +179,8 @@ export default class For extends Component {
l--;
i--;
}

this.attrs.onOut.trigger(this.data, { bubbles: true });
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/components/input.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import Akili from '../akili.js';
* @message @see Text
*/
export default class Input extends Text {
static booleanAttributes = ['checked', 'multiple'];
static events = ['change'];
static booleanAttributes = ['checked', 'multiple'].concat(Text.booleanAttributes);
static events = ['change'].concat(Text.events);

static define() {
Akili.component('input', this);
Expand Down
2 changes: 1 addition & 1 deletion src/components/radio.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import Akili from '../akili.js';
*/
export default class Radio extends For {
static matches = '[name]';
static events = ['radio'];
static events = ['radio'].concat(For.events);

static define() {
Akili.component('radio', this);
Expand Down
4 changes: 2 additions & 2 deletions src/components/select.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import Akili from '../akili.js';
* @attr [in] @see For
*/
export default class Select extends For {
static booleanAttributes = ['multiple'];
static events = ['change'];
static booleanAttributes = ['multiple'].concat(For.booleanAttributes);
static events = ['change'].concat(For.events);

static define() {
Akili.component('select', this);
Expand Down

0 comments on commit 47c21aa

Please sign in to comment.