|
@@ -191,10 +191,7 @@ exports.convertActions = function (options) {
|
|
|
* @return [ Map ] Interaction object with trigger spec.
|
|
* @return [ Map ] Interaction object with trigger spec.
|
|
|
*/
|
|
*/
|
|
|
exports.convertTrigger = function (options) {
|
|
exports.convertTrigger = function (options) {
|
|
|
- var cfg = options.trigger,
|
|
|
|
|
- isDate = Date.prototype.isPrototypeOf(cfg),
|
|
|
|
|
- isObject = Object.prototype.isPrototypeOf(cfg),
|
|
|
|
|
- trigger = !isDate && isObject ? cfg : {},
|
|
|
|
|
|
|
+ var trigger = options.trigger || {},
|
|
|
date = this.getValueFor(trigger, 'at', 'firstAt', 'date');
|
|
date = this.getValueFor(trigger, 'at', 'firstAt', 'date');
|
|
|
|
|
|
|
|
if (!trigger.type) {
|
|
if (!trigger.type) {
|
|
@@ -204,18 +201,22 @@ exports.convertTrigger = function (options) {
|
|
|
var isCal = trigger.type == 'calendar';
|
|
var isCal = trigger.type == 'calendar';
|
|
|
|
|
|
|
|
if (isCal && !date) {
|
|
if (isCal && !date) {
|
|
|
- date = this.getValueFor(options, 'at', 'firstAt', 'date') || new Date();
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- if (isCal) {
|
|
|
|
|
- date = typeof date == 'object' ? date.getTime() : date;
|
|
|
|
|
- trigger.at = Math.round(date / 1000);
|
|
|
|
|
|
|
+ date = this.getValueFor(options, 'at', 'firstAt', 'date');
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if (isCal && !trigger.every && options.every) {
|
|
if (isCal && !trigger.every && options.every) {
|
|
|
trigger.every = options.every;
|
|
trigger.every = options.every;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ if (isCal && (trigger.in || trigger.every)) {
|
|
|
|
|
+ date = null;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (isCal && date) {
|
|
|
|
|
+ date = typeof date == 'object' ? date.getTime() : date;
|
|
|
|
|
+ trigger.at = Math.round(date / 1000);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
if (!trigger.count && device.platform == 'windows') {
|
|
if (!trigger.count && device.platform == 'windows') {
|
|
|
trigger.count = trigger.every ? 5 : 1;
|
|
trigger.count = trigger.every ? 5 : 1;
|
|
|
}
|
|
}
|
|
@@ -230,6 +231,10 @@ exports.convertTrigger = function (options) {
|
|
|
trigger.radius = trigger.radius || 5;
|
|
trigger.radius = trigger.radius || 5;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ if (!isCal || trigger.at) {
|
|
|
|
|
+ delete trigger.every;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
delete options.every;
|
|
delete options.every;
|
|
|
delete options.at;
|
|
delete options.at;
|
|
|
delete options.firstAt;
|
|
delete options.firstAt;
|