【 在 zhanghaoX (环顾四方有效) 的大作中提到: 】
: 一份代码里的:
: var _ = require('underscore'), // 这种变量命名到底是是啥意思?
nothing special with _, just a name
just the name the library author sets as conventional
: Promise = require("node-promise").Promise,
: when = require("node-promise").when, //在node里找不到这个when 啊?
https://www.npmjs.com/package/node-promise
: ……
: // execute the command
: when(canExecute, function (canExecute){
: if(canExecute){
: when(that.genericCommand(cmd), function (result) {
: promise.resolve(result);
: }, function (error) {
: promise.resolve(DriverResponse.Failure(Status.State.ERROR, DriverResponse.Errors.BAD_STATE));
: }
: );
: } else {
: promise.resolve(DriverResponse.Failure(Status.State.ERROR, DriverResponse.Errors.BAD_STATE));
: }
: });
--
FROM 180.173.170.*