本文整理汇总了TypeScript中tinymce/core/util/Delay.setTimeout函数的典型用法代码示例。如果您正苦于以下问题:TypeScript setTimeout函数的具体用法?TypeScript setTimeout怎么用?TypeScript setTimeout使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setTimeout函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: function
suite.asyncTest('Externally destroyed editor', function (_, done) {
EditorManager.remove();
EditorManager.init({
selector: 'textarea',
skin_url: '/project/js/tinymce/skins/lightgray',
init_instance_callback (editor1) {
Delay.setTimeout(function () {
// Destroy the editor by setting innerHTML common ajax pattern
viewBlock.update('<textarea id="' + editor1.id + '"></textarea>');
// Re-init the editor will have the same id
EditorManager.init({
selector: 'textarea',
skin_url: '/project/js/tinymce/skins/lightgray',
init_instance_callback (editor2) {
LegacyUnit.equal(EditorManager.get().length, 1);
LegacyUnit.equal(editor1.id, editor2.id);
LegacyUnit.equal(editor1.destroyed, 1, 'First editor instance should be destroyed');
teardown(done);
}
});
}, 0);
}
});
});
示例2: function
self.show = function (time, callback) {
function render() {
if (state) {
$(elm).append(
'<div class="' + classPrefix + 'throbber' + (inline ? ' ' + classPrefix + 'throbber-inline' : '') + '"></div>'
);
if (callback) {
callback();
}
}
}
self.hide();
state = true;
if (time) {
timer = Delay.setTimeout(render, time);
} else {
render();
}
return self;
};
示例3: DomQuery
DomQuery(window).on('resize', function () {
let time;
if (self._fullscreen) {
// Time the layout time if it's to slow use a timeout to not hog the CPU
if (!slowRendering) {
time = new Date().getTime();
const rect = DomUtils.getWindowSize();
self.moveTo(0, 0).resizeTo(rect.w, rect.h);
if ((new Date().getTime()) - time > 50) {
slowRendering = true;
}
} else {
if (!self._timer) {
self._timer = Delay.setTimeout(function () {
const rect = DomUtils.getWindowSize();
self.moveTo(0, 0).resizeTo(rect.w, rect.h);
self._timer = 0;
}, 50);
}
}
}
});
示例4: function
suite.test('clearTimeout', function () {
let id;
id = Delay.setTimeout(function () {
throw new Error('clearTimeout didn\'t work.');
});
Delay.clearTimeout(id);
ok(true, 'clearTimeout works.');
});
示例5: function
self.on('show hide', function (e) {
if (e.control === self) {
if (e.type === 'show') {
Delay.setTimeout(function () {
self.classes.add('in');
}, 0);
} else {
self.classes.remove('in');
}
}
});
示例6: function
const check = function (time, count) {
const result = editor.dom.select(selector);
if (result.length > 0) {
resolve(result);
} else {
if (count === 0) {
reject();
} else {
Delay.setTimeout(function () {
check(time, count--);
}, time);
}
}
};
示例7: function
self.on('postrender show', function (e) {
if (e.control === self) {
let $modalBlockEl;
const prefix = self.classPrefix;
if (self.modal && !hasModal) {
$modalBlockEl = DomQuery('#' + prefix + 'modal-block', self.getContainerElm());
if (!$modalBlockEl[0]) {
$modalBlockEl = DomQuery(
'<div id="' + prefix + 'modal-block" class="' + prefix + 'reset ' + prefix + 'fade"></div>'
).appendTo(self.getContainerElm());
}
Delay.setTimeout(function () {
$modalBlockEl.addClass(prefix + 'in');
DomQuery(self.getEl()).addClass(prefix + 'in');
});
hasModal = true;
}
addRemove(true, self);
}
});
示例8: src
src (src) {
this.getEl().src = src;
},
/**
* Inner HTML for the iframe.
*
* @method html
* @param {String} html HTML string to set as HTML inside the iframe.
* @param {function} callback Optional callback to execute when the iframe body is filled with contents.
* @return {tinymce.ui.Iframe} Current iframe control.
*/
html (html, callback) {
const self = this, body = this.getEl().contentWindow.document.body;
// Wait for iframe to initialize IE 10 takes time
if (!body) {
Delay.setTimeout(function () {
self.html(html);
});
} else {
body.innerHTML = html;
if (callback) {
callback();
}
}
return this;
}
});