aardio 文档

thread.dlManager 库模块帮助文档

thread 成员列表

thread.dlManager

多线程下载管理器

thread.dlManager()

返回对象:threadDlManagerObject

thread.dlManager(线程数,等待延时)

创建下载管理器
参数@省略则默认创建2个下载线程可选用
参数@2指定线程每次任务完成后的等待延时,默认为200毫秒

threadDlManagerObject 成员列表

threadDlManagerObject.cancel(任务ID)

取消指定的下载任务

threadDlManagerObject.onEnd

threadDlManagerObject.onEnd = function(id,savepath,resumePath,contentLength){
    /*下载完成触发此事件  
下载成功则savepath为存储路径,否则该参数为空  
resumePath为续传配置文件路径*/
}

threadDlManagerObject.onError

threadDlManagerObject.onError = function(id,err){
    /*下载错到错误触发此事件  
出错则err参数为错误信息,用户取消则err参数为空*/
}

threadDlManagerObject.onReceive

threadDlManagerObject.onReceive = function(id,sizePs,downSize){
    /*下载触发此事件*/
}

threadDlManagerObject.onReceiveBegin

threadDlManagerObject.onReceiveBegin = function(id,url,filename,statusText,httpStatusCode,totalSize,downSize){
    /*开始下载触发此事件*/
}

threadDlManagerObject.push( 任务配置 )

threadDlManagerObject.push(   
    id = /*必须指定任务唯一标志  
参数表也是此函数的返回值*/;  
    url = "下载网址,重复的下载网址将被自动忽略";/;  
    referer = "引用网址";  
    savedir = "/download/";  
    filename = 可选参数;    
)

threadDlManagerObject.push()

返回对象:threadDlManagerTaskObject

threadDlManagerObject.quit()

关闭全部下载线程

threadDlManagerObject.works

返回对象:threadWorkObject

threadDlManagerTaskObject 成员列表

threadDlManagerTaskObject.id

任务id

Markdown 格式