script.js异步的 JavaScript 加载器

联合创作 · 2023-09-22 10:05

script.js 是一个异步的 JavaScript 加载器和依赖管理器。支持的浏览器包括:

  • IE 6+

  • Opera 10+

  • Safari 3+

  • Chrome 1+

  • Firefox 2+

示例代码:

// load jquery and plugin at the same time. name it 'bundle'
$script(['jquery.js', 'my-jquery-plugin.js'], 'bundle')

// load your usage
$script('my-app-that-uses-plugin.js')


/*--- in my-jquery-plugin.js ---*/
$script.ready('bundle', function() {
  // jquery & plugin (this file) are both ready
  // plugin code...
})


/*--- in my-app-that-uses-plugin.js ---*/
$script.ready('bundle', function() {
  // use your plugin :)
})
浏览 5
点赞
评论
收藏
分享

手机扫一扫分享

编辑
举报
评论
图片
表情
推荐
点赞
评论
收藏
分享

手机扫一扫分享

编辑
举报