我的代码
scores() {
let that = this;
this.redoCount = 0;
this.undoCount = 0;
this.datasourceList = [];
this.createDatePicker();
$("#optPlayerDetaileditor").kendoEditor({
tools: ["bold", "italic", "underline"],
change: function () {
that.sportsPlayer.sportsPlayerDetailsText = this.value();
let eventData = { "eventKey": "optPlayerDetaileditor", "sourceValue": that.sportsPlayerDetailSource, "destinationValue": that.sportsPlayer.sportsPlayerDetailsText, "type": "generateBtn" }
that.eventCapture(eventData);
that.sportsPlayerDetailSource = that.sportsPlayer.sportsPlayerDetailsText;
that.saveBtnEnableDisable();
}, encoded: true,
serialization: {
semantic: false,
entities: false,
custom: function (html) {
return html.replace(/<b>/g, "<B>").replace(/<\/b>/g, "</B>").replace(/<i>/g, "<I>").replace(/<\/i>/g, "</I>").replace(/<u>/g, "<U>")
.replace(/<\/u>/g, "</U>").replace(/<br \/>/g, "\n").replace(/ /g, " ").replace(/&/g, "&").replace(/"/g, '"').replace(/>/g, ">")
.replace(/</g, "<").replace(/·/g, ".").replace(/ /g, " ");
}
},
}).text();
}
zone.js
ZoneDelegate.prototype.invokeTask = function (targetZone, task, applyThis, applyArgs) {
try {
return this._invokeTaskZS
? this._invokeTaskZS.onInvokeTask(this._invokeTaskDlgt, this.zone, targetZone, task, applyThis, applyArgs)
: task.callback.apply(applyThis, applyArgs);
}
答案 0 :(得分:0)
不确定blackboxing Zone.js是什么意思但是调用方法task.callback.apply(applyThis, applyArgs)
来调用任何计划任务。
E.g。如果执行window.setTimeout(cb,1000);
,这实际上会调用monkey patched API而不是window.setTimeout。在该API中,新的Task
对象为created,其属性callback
已使用cb
方法中传递的setTimeout
进行初始化。此外,cb
被另一个称为timer函数的回调替换。现在,当时间到期时,JS VM将调用Zone.js的回调方法,即timer
,最终将调用task.callback.apply(applyThis, applyArgs)
。
有关Zone.js Monkey补丁API的详细信息,请参阅以下文章。