返回介绍

tinymce-dom-ScriptLoader

发布于 2019-05-06 06:49:51 字数 4811 浏览 1026 评论 0 收藏 0

Examples

// Load a script from a specific URL using the global script loader
tinymce.ScriptLoader.load('somescript.js');

// Load a script using a unique instance of the script loader
var scriptLoader = new tinymce.dom.ScriptLoader();

scriptLoader.load('somescript.js');

// Load multiple scripts
var scriptLoader = new tinymce.dom.ScriptLoader();

scriptLoader.add('somescript1.js');
scriptLoader.add('somescript2.js');
scriptLoader.add('somescript3.js');

scriptLoader.loadQueue(function() {
   alert('All scripts are now loaded.');
});

Methods

namesummarydefined by
add()Adds a specific script to the load queue of the script loader.tinymce.dom.ScriptLoader
isDone()Returns true/false if a script has been loaded or not.tinymce.dom.ScriptLoader
load()Loads a specific script directly without adding it to the load queue.tinymce.dom.ScriptLoader
loadQueue()Starts the loading of the queue.tinymce.dom.ScriptLoader
loadScripts()Loads the specified queue of files and executes the callback ones they are loaded. This method is generally not used outside this class but it might be useful in some scenarios.tinymce.dom.ScriptLoader
markDone()Marks a specific script to be loaded. This can be useful if a script got loaded outside the script loader or to skip it from loading some script.tinymce.dom.ScriptLoader

Methods

add

add(url:String, success:function, scope:Object, failure:function)

Adds a specific script to the load queue of the script loader.

Parameters
  • url (String) - Absolute URL to script to add.
  • success (function) - Optional success callback function to execute when the script loades successfully.
  • scope (Object) - Optional scope to execute callback in.
  • failure (function) - Optional failure callback function to execute when the script failed to load.

isDone

isDone(url:String):Boolean

Returns true/false if a script has been loaded or not.

Parameters
  • url (String) - URL to check for.
Return value
  • Boolean - true/false if the URL is loaded.

load

load(url:String, callback:function, callback:function)

Loads a specific script directly without adding it to the load queue.

Parameters
  • url (String) - Absolute URL to script to add.
  • callback (function) - Optional success callback function when the script loaded successfully.
  • callback (function) - Optional failure callback function when the script failed to load.

loadQueue

loadQueue(success:function, failure:function, scope:Object)

Starts the loading of the queue.

Parameters
  • success (function) - Optional callback to execute when all queued items are loaded.
  • failure (function) - Optional callback to execute when queued items failed to load.
  • scope (Object) - Optional scope to execute the callback in.

loadScripts

loadScripts(scripts:Array, callback:function, scope:Object, callback:function)

Loads the specified queue of files and executes the callback ones they are loaded. This method is generally not used outside this class but it might be useful in some scenarios.

Parameters
  • scripts (Array) - Array of queue items to load.
  • callback (function) - Optional callback to execute when scripts is loaded successfully.
  • scope (Object) - Optional scope to execute callback in.
  • callback (function) - Optional callback to execute if scripts failed to load.

markDone

markDone(url:string)

Marks a specific script to be loaded. This can be useful if a script got loaded outside the script loader or to skip it from loading some script.

Parameters
  • url (string) - Absolute URL to the script to mark as loaded.

Can't find what you're looking for? Let us know.

Except as otherwise noted, the content of this page is licensed under the Creative Commons BY-NC-SA 3.0 License, and code samples are licensed under the Apache 2.0 License.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文