本文整理匯總了TypeScript中tinymce/core/api/util/Delay.setTimeout函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript setTimeout函數的具體用法?TypeScript setTimeout怎麽用?TypeScript setTimeout使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了setTimeout函數的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: function
editor.settings.images_upload_handler = function (data, success, failure) {
uploadCount++;
Delay.setTimeout(function () {
failure('Error');
}, 0);
};
示例2: 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);
}
});
});
示例3: 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;
};
示例4:
onAction: (api, _actionData) => {
Delay.setTimeout(() => {
const currentData = api.getData();
store.adder('currentData: ' + currentData.fieldA)();
// Currently, this will be ignored once the dialog is closed.
api.setData({
fieldA: 'New Value'
});
// Check all APIs do not throw errors
api.disable('async.setData');
api.enable('async.setData');
api.block('message');
api.unblock();
api.showTab('new tab');
// Currently, it is only going to validate it if the dialog is still open
api.redial({
title: 'temporary redial to check the API',
body: {
type: 'panel',
items: []
},
buttons: []
});
api.close();
store.adder('newData: ' + currentData.fieldA)();
}, 2000);
}
示例5: done
const fallback = (editor: Editor): FallbackFn => (html, done) => {
const markedHtml = InternalHtml.mark(html);
const outer = editor.dom.create('div', {
'contenteditable': 'false',
'data-mce-bogus': 'all'
});
const inner = editor.dom.create('div', { contenteditable: 'true' }, markedHtml);
editor.dom.setStyles(outer, {
position: 'fixed',
top: '0',
left: '-3000px',
width: '1000px',
overflow: 'hidden'
});
outer.appendChild(inner);
editor.dom.add(editor.getBody(), outer);
const range = editor.selection.getRng();
inner.focus();
const offscreenRange: Range = editor.dom.createRng();
offscreenRange.selectNodeContents(inner);
editor.selection.setRng(offscreenRange);
Delay.setTimeout(() => {
editor.selection.setRng(range);
outer.parentNode.removeChild(outer);
done();
}, 0);
};
示例6: 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);
}
}
}
});
示例7: setClipboardData
setClipboardData(evt, getData(editor), fallback(editor), () => {
// Chrome fails to execCommand from another execCommand with this message:
// "We don't execute document.execCommand() this time, because it is called recursively.""
Delay.setTimeout(() => { // detach
editor.execCommand('Delete');
}, 0);
});
示例8: 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.');
});
示例9: 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');
}
}
});