script.js 介绍
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 :) })