javascript then方法是异步执行,就是当【.then()】前的方法执行完后再执行【then()】内部的程序,这样就避免了数据没获取到等的问题,语法为【promise.then(onCompleted, onRejected)】。

本教程操作环境:windows7系统、javascript1.8.5版,DELL G3电脑。 then()方法是异步执行。 意思是:就是当.then()前的方法执行完后再执行then()内部的程序,这样就避免了,数据没获取到等的问题。 语法: promise.then(onCompleted, onRejected); 4、参数 举例: vstart() {
super.start();
if (this.transport) {
return this.transport.ready.then(() => {
return this.clientSM.start();
});
} else {
return Promise.reject("no transport attached");
}
}相关免费学习推荐:javascript视频教程
以上就是javascript then方法是什么的详细内容,更多请关注模板之家(www.mb5.com.cn)其它相关文章! |