getScriptSet

授权协议 未知
开发语言
所属分类 jQuery 插件、 其他jQuery插件
软件类型 开源软件
地区 不详
投 递 者 万英武
操作系统 未知
开源组织
适用人群 未知
 软件概览

Extends jQuery with our custom multi-resource asynchronous script receiver.

It ensures that the onLoaded callback will only be executed when all scripts have been loaded. It also maintains a cache of already loaded URL's to prevent multiple downloads. It also supports loading script that have their own loading mechanism, like Google Maps, by offering a way to take their callback and inject it into ourselves.

Resources are passed in the following style:

[
  "simple_javascript_file.js",
   {
      url: 'js_file_with_own_loader',
      callbackSetter: function(callback) {
        // The callback parameter is the callback that 'js_file_with_own_loader' _needs_
        // to call when it completes. So you could do it like this for example:
        module.addListener( 'onLoad', callback ) ;
        // Or you can check the example below for how it works with Google Maps e.g.
      }
  }
]

This is a sample resource definition for loading Google Maps with our own custom script that extends the Google Map object:
<code>
[ "my_google_maps_extension.js",
{ url: "http://maps.google.com/maps?file=api&v=2&key=" + GMAP_KEY + "&async=2&callback=_gmapsOwnOnLoadCallback",
  callbackSetter: function(callback) { self._gmapsOwnOnLoadCallback = callback }
} ]

相关阅读

相关文章

相关问答

相关文档