doFunc
This commit is contained in:
parent
a89e397a40
commit
cb2e9f4abd
@ -94,7 +94,7 @@ actions.prototype.doRegisteredAction = function (action) {
|
||||
var actions = this.actions[action];
|
||||
if (!actions) return false;
|
||||
for (var i = 0; i < actions.length; ++i) {
|
||||
if (core.doFunc.apply(this, [actions[i].func].concat(Array.prototype.slice.call(arguments, 1))))
|
||||
if (core.doFunc.apply(core, [actions[i].func, this].concat(Array.prototype.slice.call(arguments, 1))))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
@ -69,7 +69,7 @@ control.prototype._setRequestAnimationFrame = function () {
|
||||
if (b.func) {
|
||||
try {
|
||||
if (core.isPlaying() || !b.needPlaying)
|
||||
core.doFunc(b.func, timestamp);
|
||||
core.doFunc(b.func, core.control, timestamp);
|
||||
}
|
||||
catch (e) {
|
||||
main.log(e);
|
||||
@ -1257,7 +1257,7 @@ control.prototype.unregisterReplayAction = function (name) {
|
||||
control.prototype._doReplayAction = function (action) {
|
||||
for (var i in this.replayActions) {
|
||||
try {
|
||||
if (core.doFunc(this.replayActions[i].func, action)) return true;
|
||||
if (core.doFunc(this.replayActions[i].func, this, action)) return true;
|
||||
} catch (e) {
|
||||
main.log(e);
|
||||
main.log("ERROR in replayActions["+this.replayActions[i].name+"]:已自动注销该项。");
|
||||
@ -2393,7 +2393,7 @@ control.prototype.unregisterResize = function (name) {
|
||||
control.prototype._doResize = function (obj) {
|
||||
for (var i in this.resizes) {
|
||||
try {
|
||||
if (core.doFunc(this.resizes[i].func, obj)) return true;
|
||||
if (core.doFunc(this.resizes[i].func, this, obj)) return true;
|
||||
} catch (e) {
|
||||
main.log(e);
|
||||
main.log("ERROR in resizes["+this.resizes[i].name+"]:已自动注销该项。");
|
||||
|
||||
@ -383,9 +383,12 @@ core.prototype._forwardFunc = function (name, funcname) {
|
||||
eval("core." + funcname + " = function (" + parameters + ") {\n\treturn core." + name + "." + funcname + "(" + parameters + ");\n}");
|
||||
}
|
||||
|
||||
core.prototype.doFunc = function (func) {
|
||||
if (typeof func == 'string') func = core.plugin[func];
|
||||
return func.apply(this, Array.prototype.slice.call(arguments, 1));
|
||||
core.prototype.doFunc = function (func, _this) {
|
||||
if (typeof func == 'string') {
|
||||
func = core.plugin[func];
|
||||
_this = core.plugin;
|
||||
}
|
||||
return func.apply(_this, Array.prototype.slice.call(arguments, 2));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -247,7 +247,7 @@ events.prototype.unregisterSystemEvent = function (type) {
|
||||
events.prototype.doSystemEvent = function (type, data, callback) {
|
||||
if (this.systemEvents[type]) {
|
||||
try {
|
||||
return core.doFunc(this.systemEvents[type], data, data, callback);
|
||||
return core.doFunc(this.systemEvents[type], this, data, data, callback);
|
||||
}
|
||||
catch (e) {
|
||||
main.log(e);
|
||||
@ -722,7 +722,7 @@ events.prototype.doEvent = function (data, x, y, prefix) {
|
||||
var type = data.type;
|
||||
if (this.actions[type]) {
|
||||
try {
|
||||
return core.doFunc(this.actions[type], data, x, y, prefix);
|
||||
return core.doFunc(this.actions[type], this, data, x, y, prefix);
|
||||
}
|
||||
catch (e) {
|
||||
main.log(e);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user