Skip to content

Commit

Permalink
+ 控制器执行入参
Browse files Browse the repository at this point in the history
  • Loading branch information
cloudcome committed Mar 14, 2018
1 parent 7576db1 commit bc83d68
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"dependencies": {
"blear.classes.class": "^1.1.7",
"blear.classes.events": "^1.0.7",
"blear.utils.access": "^1.0.5",
"blear.utils.array": "^1.0.12",
"blear.utils.function": "^1.0.5",
"blear.utils.scope-css": "^1.0.3"
Expand Down
18 changes: 8 additions & 10 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
var Events = require('blear.classes.events');
var fun = require('blear.utils.function');
var array = require('blear.utils.array');
var access = require('blear.utils.access');

var win = window;
var Controller = Events.extend({
Expand All @@ -23,21 +24,17 @@ var Controller = Events.extend({
the[_hideCallbackList] = [];
the[_updateCallbackList] = [];
the[_exports] = {
init: function (view, route) {
the.view = view;
the.route = route;
},
install: function () {
the[_execCallback](_installCallbackList);
the[_execCallback](_installCallbackList, arguments);
},
show: function () {
the[_execCallback](_showCallbackList);
the[_execCallback](_showCallbackList, arguments);
},
hide: function () {
the[_execCallback](_hideCallbackList);
the[_execCallback](_hideCallbackList, arguments);
},
update: function () {
the[_execCallback](_updateCallbackList);
the[_execCallback](_updateCallbackList, arguments);
}
};
},
Expand Down Expand Up @@ -134,11 +131,12 @@ prop[_pushCallback] = function (name, callback) {
return the;
};

prop[_execCallback] = function (name) {
prop[_execCallback] = function (name, args) {
var the = this;

args = access.args(args);
array.each(the[name], function (inde, callback) {
callback.call(win, the.view, the.route);
callback.apply(win, args);
});

return the;
Expand Down

0 comments on commit bc83d68

Please sign in to comment.