Light12306/RwTicketAssistantV2/app/air/js/flight/Monitor.js
iFish addcafcdf8 + 集成扩展的源码
+ 增加相关TypedScript的导入
2014-08-08 14:33:43 +08:00

41 lines
806 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* 监控monitor用于判断
* @class Monitor
* @constructor
* @param {String} type: absolute/relative
* @param {Number} extra: 低于的价格type=absolute时生效
*/
var Monitor = function(type, price) {
this.type = type;
this.price = price;
this.time = Util.date.now();
};
Monitor.prototype.getSetting = function() {
return {
type: this.type,
price: this.price,
time: this.time
};
};
Monitor.prototype.judge = function(flight) {
};
var MonitorFactory = {
getFromKeeper: function() {
var info = InputKeeper.getInfo();
if (info.type == 'absolute') {
return new Monitor('absolute', parseInt(info.absolutePrice, 10));
} else {
return new Monitor('relative');
}
},
getFromSetting: function(setting) {
return new Monitor(setting.type, setting.price);
}
};