script.js異步的 JavaScript 加載器
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 :)
})評論
圖片
表情
