属性
使用频率 |
中高 |
所属模块 |
Std.sourceRepository
|
成员类型 |
公有成员函数 |
描述
use方法可以载入sourceRepository中已存在的包,use方法的第一个参数可以是一个字符串名称,或者包含多个名称的数组.
语法
Object use(String name);
Object use(Array names);
Object use(String name,Function callback);
Object use(Array names,Function callback);
参数
名称 |
类型 |
描述 |
name |
String |
仓库中存在的包的名称 |
names |
Array |
包含多个名称的数组 |
callback |
Function |
当包载入完成之后执行的回调函数 |
相关例子
var repository = new Std.sourceRepository();
repository.add("io.websocket","http://source.stdjs.com/0.1/io/websocket.js");
repository.use("io.websocket",function(){
console.log("do something....");
});