本文整理匯總了TypeScript中tinymce/core/api/util/EventDispatcher.off函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript off函數的具體用法?TypeScript off怎麽用?TypeScript off使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了off函數的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: function
suite.test('toggleEvent setting', function () {
let lastName, lastState, dispatcher;
dispatcher = new EventDispatcher({
toggleEvent (name, state) {
lastName = name;
lastState = state;
}
});
const listenerA = function () {
};
const listenerB = function () {
};
dispatcher.on('click', listenerA);
LegacyUnit.equal(lastName, 'click');
LegacyUnit.equal(lastState, true);
lastName = lastState = null;
dispatcher.on('click', listenerB);
LegacyUnit.equal(lastName, null);
LegacyUnit.equal(lastState, null);
dispatcher.off('click', listenerA);
LegacyUnit.equal(lastName, null);
LegacyUnit.equal(lastState, null);
dispatcher.off('click', listenerB);
LegacyUnit.equal(lastName, 'click');
LegacyUnit.equal(lastState, false);
});