phaser4-rex-plugins
Version:
17 lines (14 loc) • 364 B
JavaScript
var AddCommand = function (name, callback, scope) {
if (scope === undefined) {
scope = this;
}
if (scope) {
callback = callback.bind(scope);
}
if (this[name]) {
console.warn(`CommandExecutor: method '${name} is existed.`);
}
this[name] = callback;
return this;
}
export default AddCommand;