{"action":"created","comment":{"url":"https://api.github.com/repos/enyojs/moonstone/pulls/comments/26860919","id":26860919,"diff_hunk":"@@ -0,0 +1,690 @@\n+(function (enyo, scope) {\n+\t/**\n+\t* Fires when the value changes.\n+\t*\n+\t* @event moon.DurationPicker#onChange\n+\t* @type {Object}\n+\t* @property {String} name - contains the name of this control.\n+\t* @public\n+\t*/\n+\n+\t/**\n+\t* `moon.DurationPicker` is a [control]{@link enyo.Control} that can display -- or allow the\n+\t* selection of -- a duration expressed in hours, minutes and seconds, the selection\n+\t* display is configurable using template.\n+\t*/\n+\n+\tvar \n+\t\t/**\n+\t\t* Optional label for hour\n+\t\t*\n+\t\t* @type {String}\n+\t\t* @default moon.$L(\"1#hour|#hours\")\n+\t\t* @private\n+\t\t*/\n+\t\thourText = moon.$L(\"1#hour|#hours\"),\t\t// i18n 'HOUR' label in moon.DurationPicker widget\n+\n+\t\t/**\n+\t\t* Optional label for minute\n+\t\t*\n+\t\t* @type {String}\n+\t\t* @default moon.$L('1#minute|#minutes')\n+\t\t* @private\n+\t\t*/\n+\t\tminuteText = moon.$L('1#minute|#minutes'),\t// i18n 'MINUTE' label in moon.DurationPicker widget\n+\n+\t\t/**\n+\t\t* Optional label for second\n+\t\t*\n+\t\t* @type {String}\n+\t\t* @default moon.$L('1#second|#seconds')\n+\t\t* @private\n+\t\t*/\n+\t\tsecondText = moon.$L('1#second|#seconds'),\t// i18n 'SECOND' label in moon.DurationPicker widget\n+\n+\t\t/**\n+\t\t* Optional label for Start Button\n+\t\t*\n+\t\t* @type {String}\n+\t\t* @default moon.$L('Start')\n+\t\t* @private\n+\t\t*/\n+\t\tstartText = moon.$L('Start'),\t\t\t// i18n 'Start' label in moon.DurationPicker buttons\n+\n+\t\t/**\n+\t\t* Optional label for Pause Button\n+\t\t*\n+\t\t* @type {String}\n+\t\t* @default moon.$L('Pause')\n+\t\t* @private\n+\t\t*/\n+\t\tpauseText = moon.$L('Pause'),\t\t\t// i18n 'Pause' label in moon.DurationPicker buttons\n+\n+\t\t/**\n+\t\t* Optional label for Cancel Button\n+\t\t*\n+\t\t* @type {String}\n+\t\t* @default moon.$L('Cancel')\n+\t\t* @private\n+\t\t*/\n+\t\tcancelText = moon.$L('Cancel'),\t\t\t// i18n 'Cancel' label in moon.DurationPicker buttons\n+\n+\t\t/**\n+\t\t* Optional label for Resume Button\n+\t\t*\n+\t\t* @type {String}\n+\t\t* @default moon.$L('Resume')\n+\t\t* @private\n+\t\t*/\n+\t\tresumeText = moon.$L('Resume');\t\t\t// i18n 'Resume' label in moon.DurationPicker buttons\n+\n+\t/*\n+\t* @class moon.DurationPicker\n+\t* @ui\n+\t* @public\n+\t*/\n+\n+\tenyo.kind(\n+\t\t/** @lends moon.DurationPicker.prototype */ {\n+\n+\t\t/**\n+\t\t* @private\n+\t\t*/\n+\t\tname: 'moon.DurationPicker',\n+\n+\t\t/**\n+\t\t* @private\n+\t\t*/\n+\t\tkind: 'moon.ExpandableListItem',\n+\n+\t\t/**\n+\t\t* @private\n+\t\t*/\n+\t\tdefaultKind: 'enyo.Control',\n+\n+\t\t/**\n+\t\t* @private\n+\t\t*/\n+\t\tclasses: 'moon-duration-picker moon-expandable-picker',\n+\n+\t\t/**\n+\t\t* @private\n+\t\t*/\n+\t\thandlers: {\n+\t\t\t//* Handler for _onChange_ events coming from constituent controls\n+\t\t\tonChange: 'handleChangeEvent'\n+\t\t},\n+\n+\t\tevents: {\n+\t\t\t/**\n+\t\t\t* {@link moon.DurationPicker#event:onDurationChange}\n+\t\t\t*/\n+\t\t\tonDurationChange: '',\n+\n+\t\t\t/**\n+\t\t\t* {@link moon.DurationPicker#event:onCountdownExpired}\n+\t\t\t*/\n+\t\t\tonPickerExpired: ''\n+\t\t},\n+\n+\t\t/**\n+\t\t* @type {Boolean}\n+\t\t* @default true\n+\t\t* @private\n+\t\t*/\n+\t\tpauseDisabled: true,\n+\n+\t\t/**\n+\t\t* @public\n+\t\t* @lends moon.DurationPicker.prototype\n+\t\t*/\n+\t\tpublished: {\n+\n+\t\t\t/**\n+\t\t\t* Text to be displayed as the current value if no item is currently selected\n+\t\t\t*\n+\t\t\t* @type {String}\n+\t\t\t* @default ''\n+\t\t\t* @public\n+\t\t\t*/\n+\t\t\tnoneText: '',\n+\n+\t\t\t/**\n+\t\t\t* The value of the picker, expressed as a standard JavaScript \n+\t\t\t* object.\n+\t\t\t*\n+\t\t\t* @type {String}\n+\t\t\t* @default null\n+\t\t\t* @public\n+\t\t\t*/\n+\t\t\tvalue: null,\n+\n+\t\t\t/**\n+\t\t\t* The template format of the picker\n+\t\t\t*\n+\t\t\t* @type {String}\n+\t\t\t* @default ''\n+\t\t\t* @public\n+\t\t\t*/\n+\t\t\ttemplate: '',\n+\n+\t\t\t/**\n+\t\t\t* Enable and disable the timer feature of duration picker\n+\t\t\t*\n+\t\t\t* @type {Boolean}\n+\t\t\t* @default true\n+\t\t\t* @public\n+\t\t\t*/\n+\t\t\tenableTimer: true\n+\t\t},\n+\n+\t\t/**\n+\t\t* @private\n+\t\t*/\n+\t\tcomponents: [\n+\t\t\t{name: 'headerWrapper', kind: 'moon.Item', classes: 'moon-date-picker-header-wrapper', onSpotlightFocus: 'headerFocus', ontap: 'expandContract', components: [\n+\t\t\t\t// headerContainer required to avoid bad scrollWidth returned in RTL for certain text widths (webkit bug)\n+\t\t\t\t{name: 'headerContainer', classes: 'moon-expandable-list-item-header moon-expandable-picker-header moon-expandable-datetime-header', components: [\n+\t\t\t\t\t{name: 'header', kind: 'moon.MarqueeText'}\n+\t\t\t\t]},\n+\t\t\t\t{name: 'currentValue', kind: 'moon.MarqueeText', classes: 'moon-expandable-picker-current-value'}\n+\t\t\t]},\n+\t\t\t{name: 'drawer', kind: 'enyo.Drawer', resizeContainer: false, classes: 'moon-expandable-list-item-client moon-duration-picker-item', components: [\n+\t\t\t\t{name: 'client', kind: 'enyo.Control', classes: 'enyo-tool-decorator', onSpotlightLeft: 'closePicker', onSpotlightSelect: 'closePicker'},\n+\t\t\t\t{name: 'buttonPlaceHolder', components: [\n+\t\t\t\t\t{kind: 'moon.Button', name: 'startButton', small: true, ontap: 'startTapped'},\n+\t\t\t\t\t{kind: 'moon.Button', name: 'pauseButton', small: true, ontap: 'pauseTapped'}\n+\t\t\t\t]}\n+\t\t\t]}\n+\t\t],\n+\n+\t\t/**\n+\t\t* @private\n+\t\t*/\n+\t\tbindings: [\n+\t\t\t{from: 'disabled', to: '$.headerWrapper.disabled'},\n+\t\t\t{from: 'startContent', to: '$.startButton.content'},\n+\t\t\t{from: 'pauseContent', to: '$.pauseButton.content'},\n+\t\t\t{from: 'pauseDisabled', to: '$.pauseButton.disabled'},\n+\t\t\t{from: 'enableTimer', to: '$.buttonPlaceHolder.showing'},\n+\t\t\t{from: 'showHour', to: '$.hourPicker.showing'},\n+\t\t\t{from: 'showMinute', to: '$.minutePicker.showing'},\n+\t\t\t{from: 'showSecond', to: '$.secondPicker.showing'}\n+\t\t],\n+\n+\t\t/**\n+\t\t* @private\n+\t\t*/\n+\t\tcreate: function () {\n+\t\t\tthis.inherited(arguments);\n+\t\t\tthis.initDefaults();\n+\t\t},\n+\n+\t\t/**\n+\t\t* @private\n+\t\t*/\n+\t\tinitDefaults: function () {\n+\t\t\tthis.values = {\n+\t\t\t\t'hour': 0,\n+\t\t\t\t'minute': 0,\n+\t\t\t\t'second': 0\n+\t\t\t};\n+\t\t\tthis.hourStr = new ilib.String(hourText);\n+\t\t\tthis.minuteStr = new ilib.String(minuteText);\n+\t\t\tthis.secondStr = new ilib.String(secondText);\n+\t\t\tthis.templateArray = [];\n+\t\t\tthis.startContent = startText;\n+\t\t\tthis.pauseContent = pauseText;\n+\t\t\tthis.setupPickers();\n+\t\t\tthis.initTemplate();\n+\t\t\tif(this.value !== '') {\n+\t\t\t\tthis.valueChanged();\n+\t\t\t} else {\n+\t\t\t\tthis.noneTextUpdate();\n+\t\t\t}\n+\t\t},\n+\n+\t\t/**\n+\t\t* creating the hour, minute and second picker components\n+\t\t*\n+\t\t* @private\n+\t\t*/\n+\t\tsetupPickers: function () {\n+\t\t\tthis.createComponent(\n+\t\t\t\t{name: 'hourPicker', classes: 'moon-date-picker-wrap', components:[\n+\t\t\t\t\t{kind: 'moon.IntegerPicker', name: 'hour', min: 0, max: 23, wrap: true, value: this.values.hour, disabled: this.countdown},\n+\t\t\t\t\t{name: 'hourLabel', content: this.hourStr.formatChoice(1), classes: 'moon-date-picker-label moon-divider-text'}\n+\t\t\t\t]}\n+\t\t\t);\n+\t\t\tthis.createComponent(\n+\t\t\t\t{name: 'minutePicker', classes: 'moon-date-picker-wrap', components:[\n+\t\t\t\t\t{kind: 'moon.IntegerPicker', name: 'minute', classes: 'moon-date-picker-field', min: 0, max: 59, wrap: true, value: this.values.minute, disabled: this.countdown},\n+\t\t\t\t\t{name: 'minuteLabel', content: this.minuteStr.formatChoice(1), classes: 'moon-date-picker-label moon-divider-text'}\n+\t\t\t\t]}\n+\t\t\t);\n+\t\t\tthis.createComponent(\n+\t\t\t\t{name: 'secondPicker', classes: 'moon-date-picker-wrap', components:[\n+\t\t\t\t\t{kind: 'moon.IntegerPicker', name: 'second', classes: 'moon-date-picker-field', min: 0, max: 59, wrap: true, value: this.values.second, disabled: this.countdownSS},\n+\t\t\t\t\t{name: 'secondLabel', content: this.secondStr.formatChoice(1), classes: 'moon-date-picker-label moon-divider-text'}\n+\t\t\t\t]}\n+\t\t\t);\n+\t\t},\n+\n+\t\t/**\n+\t\t* @private\n+\t\t*/\n+\t\tinitTemplate: function () {\n+\t\t\tif (this.template) {\n+\t\t\t\tvar orderingArr = this.template.toLowerCase().split('');\n+\t\t\t\tvar o,f,l;\n+\t\t\t\tfor (f = 0, l = orderingArr.length; f < l; f++) {\n+\t\t\t\t\to = orderingArr[f].toLowerCase();\n+\t\t\t\t\t//only accepts the hour, minute, second template values 'h', 'm' and 's'\n+\t\t\t\t\tif (this.templateArray.indexOf(o) < 0 && (o == 'h' || o == 'm' || o == 's' )) {\n+\t\t\t\t\t\tthis.templateArray.push(o);\n+\t\t\t\t\t\tswitch (o) {\n+\t\t\t\t\t\tcase 'h':\n+\t\t\t\t\t\t\tthis.set('showHour', true);\n+\t\t\t\t\t\t\tbreak;\n+\t\t\t\t\t\tcase 'm':\n+\t\t\t\t\t\t\tthis.set('showMinute', true);\n+\t\t\t\t\t\t\tbreak;\n+\t\t\t\t\t\tcase 's':\n+\t\t\t\t\t\t\tthis.set('showSecond', true);\n+\t\t\t\t\t\t\tbreak;\n+\t\t\t\t\t\tdefault:\n+\t\t\t\t\t\t\tbreak;\n+\t\t\t\t\t\t}\n+\t\t\t\t\t}\n+\t\t\t\t}\n+\t\t\t\tif (!this.templateArray.length) {\n+\t\t\t\t\tthis.templateArray.push('h','m','s');\n+\t\t\t\t\tthis.set('showHour', true);\n+\t\t\t\t\tthis.set('showMinute', true);\n+\t\t\t\t\tthis.set('showSecond', true);\n+\t\t\t\t}\n+\t\t\t\treturn;\n+\t\t\t}\n+\t\t\tthis.set('showHour', true);\n+\t\t\tthis.set('showMinute', true);\n+\t\t\tthis.set('showSecond', true);\n+\t\t\tthis.templateArray.push('h','m','s');\n+\t\t},\n+\n+\t\t/**\n+\t\t* @fires moon.DurationePicker#onChange\n+\t\t* @private\n+\t\t*/\n+\t\thandleChangeEvent: function (sender, ev) {\n+\t\t\tif (ev && ev.originator === this) {\n+\t\t\t\t// Don't handle our own change events\n+\t\t\t\treturn;\n+\t\t\t} else {\n+\t\t\t\tthis.updateValue(sender, ev);\n+\t\t\t\treturn true;\n+\t\t\t}\n+\t\t},\n+\n+\t\t/**\n+\t\t* @private\n+\t\t*/\n+\t\ttemplateChanged: function () {\n+\t\t\tthis.templateArray = [];\n+\t\t\tthis.hidePickers();\n+\t\t\tthis.initTemplate();\n+\t\t\tthis.updateText();\n+\t\t},\n+\n+\t\t/**\n+\t\t* If no item is selected, uses [`noneText`]{@link moon.DurationPicker#noneText}\n+\t\t* as current value and if noneText value is not provided, use 'Pick Duration'\n+\t\t* as default.\n+\t\t*\n+\t\t* @private\n+\t\t*/\n+\t\tnoneTextUpdate: function () {\n+\t\t\tthis.$.currentValue.set('content', moon.$L(this.getNoneText()) || moon.$L('Pick Duration'));\n+\t\t\tthis.doDurationChange({name: this.name, value: this.$.currentValue.content});\n+\t\t},\n+\n+\t\t/**\n+\t\t* @private\n+\t\t*/\n+\t\tnoneTextChanged: function () {\n+\t\t\tif (this.value == null || this.value === '') {\n+\t\t\t\tthis.noneTextUpdate();\n+\t\t\t}\n+\t\t},\n+\n+\t\t/**\n+\t\t* @private\n+\t\t*/\n+\t\tvalueChanged: function () {\n+\t\t\tif (this.value == null || this.value === '') {\n+\t\t\t\tthis.resetPicker();\n+\t\t\t\tthis.noneTextUpdate();\n+\t\t\t} else {\n+\t\t\t\tthis.createValues();\n+\t\t\t\tthis.updatePicker();\n+\t\t\t\tthis.updateText();\n+\t\t\t}\n+\t\t},\n+\n+\t\t/**\n+\t\t* @private\n+\t\t*/\n+\t\tcreateValues: function () {\n+\t\t\tvar tempValue;\n+\t\t\tif (this.value != null && this.value !== '') {\n+\t\t\t\tvar timeArray = this.value.toString().split(':');\n+\t\t\t\ttempValue = 0;\n+\t\t\t\tif (this.showHour || !this.showHour && timeArray.length > 2) {\n+\t\t\t\t\ttempValue = Math.round(timeArray.shift());\n+\t\t\t\t\tif (isNaN(tempValue) || tempValue > 23 || tempValue < 0) {\n+\t\t\t\t\t\ttempValue = 0;\n+\t\t\t\t\t}\n+\t\t\t\t}\n+\t\t\t\tthis.values['hour'] = tempValue;\n+\t\t\t\ttempValue = 0;\n+\t\t\t\tif (this.showMinute || !this.showMinute && timeArray.length > 1) {\n+\t\t\t\t\ttempValue = Math.round(timeArray.shift());\n+\t\t\t\t\tif (isNaN(tempValue) || tempValue > 59 || tempValue < 0) {\n+\t\t\t\t\t\ttempValue = 0;\n+\t\t\t\t\t}\n+\t\t\t\t}\n+\t\t\t\tthis.values['minute'] = tempValue;\n+\t\t\t\ttempValue = 0;\n+\t\t\t\tif (this.showSecond || !this.showSecond && timeArray.length > 0) {\n+\t\t\t\t\ttempValue = Math.round(timeArray.shift());\n+\t\t\t\t\tif (isNaN(tempValue) || tempValue> 59 || tempValue < 0) {\n+\t\t\t\t\t\ttempValue = 0;\n+\t\t\t\t\t}\n+\t\t\t\t}\n+\t\t\t\tthis.values['second'] = tempValue;\n+\t\t\t}\n+\t\t},\n+\n+\t\t/**\n+\t\t* @private\n+\t\t*/\n+\t\tupdatePicker: function () {\n+\t\t\tif (this.$.hour.value != this.values['hour'])\n+\t\t\t\tthis.$.hour.set('value', this.values['hour']);\n+\n+\t\t\tif (this.$.minute.value != this.values['minute'])\n+\t\t\t\tthis.$.minute.set('value', this.values['minute']);\n+\n+\t\t\tif (this.$.second.value != this.values['second'])\n+\t\t\t\tthis.$.second.set('value',this.values['second']);\n+\t\t},\n+\n+\t\t/**\n+\t\t* @private\n+\t\t*/\n+\t\tupdateText: function () {\n+\t\t\tvar text, \n+\t\t\t\tval = {},\n+\t\t\t\tzeroValue = true,\n+\t\t\t\tdurFormat = new ilib.DurFmt({length: 'full', useNative: false});\n+\t\t\tif (this.values) {\n+\t\t\t\tfor (var idx = 0; idx < this.templateArray.length; idx++) {\n+\t\t\t\t\tvar item = this.templateArray[idx];\n+\t\t\t\t\tswitch (item) {\n+\t\t\t\t\t\tcase 'h':\n+\t\t\t\t\t\t\tif (this.values['hour'] !== 0) {\n+\t\t\t\t\t\t\t\tval.hour = this.values['hour'];\n+\t\t\t\t\t\t\t\tzeroValue = false;\n+\t\t\t\t\t\t\t}\n+\t\t\t\t\t\tbreak;\n+\t\t\t\t\t\tcase 'm':\n+\t\t\t\t\t\t\tif (this.values['minute'] !== 0) {\n+\t\t\t\t\t\t\t\tval.minute = this.values['minute'];\n+\t\t\t\t\t\t\t\tzeroValue = false;\n+\t\t\t\t\t\t\t}\n+\t\t\t\t\t\tbreak;\n+\t\t\t\t\t\tcase 's':\n+\t\t\t\t\t\t\tif (this.values['second'] !== 0) {\n+\t\t\t\t\t\t\t\tval.second = this.values['second'];\n+\t\t\t\t\t\t\t\tzeroValue = false;\n+\t\t\t\t\t\t\t}\n+\t\t\t\t\t\tbreak;\n+\t\t\t\t\t}\n+\t\t\t\t}\n+\t\t\t}\n+\t\t\tif (zeroValue) {\n+\t\t\t\tthis.noneTextUpdate();\n+\t\t\t} else {\n+\t\t\t\ttext = durFormat.format(val);\n+\t\t\t\tthis.$.currentValue.set('content', text);\n+\t\t\t\tthis.doDurationChange({name: this.name, value: text});\n+\t\t\t}\n+\t\t},\n+\n+\t\t/**\n+\t\t* @private\n+\t\t*/\n+\t\ttick: function () {\n+\t\t\tvar hr = this.values['hour'],\n+\t\t\t\tmn = this.values['minute'],\n+\t\t\t\tss = this.values['second'];\n+\t\t\tss--;\n+\t\t\tif (hr <= 0 && mn <= 0 && ss <= 0) {\n+\t\t\t\tthis.set('value','');\n+\t\t\t\tthis.pickerExpired();\n+\t\t\t\treturn;\n+\t\t\t} else {\n+\t\t\t\tif (ss <= 0) {\n+\t\t\t\t\tss = 59;\n+\t\t\t\t\tif (mn > 0) {\n+\t\t\t\t\t\tmn--;\n+\t\t\t\t\t} else {\n+\t\t\t\t\t\tmn = 59;\n+\t\t\t\t\t\thr--;\n+\t\t\t\t\t}\n+\t\t\t\t}\n+\t\t\t}\n+\t\t\tthis.set('value', hr+':'+mn+':'+ss);\n+\t\t},\n+\n+\t\t/**\n+\t\t* @private\n+\t\t*/\n+\t\tupdateValue: function (sender, ev) {\n+\t\t\tvar hour = this.$.hour.get('value'),\n+\t\t\t\tminute = this.$.minute.get('value'),\n+\t\t\t\tsecond = this.$.second.get('value');\n+\t\t\tif (ev.name == this.secondStr.formatChoice(1) && this.values['second'] == second) {\n+\t\t\t\treturn;\n+\t\t\t} else if (ev.name == this.minuteStr.formatChoice(1) &&  this.values['minute'] == minute) {\n+\t\t\t\treturn;\n+\t\t\t} else if (ev.name == this.hourStr.formatChoice(1) && this.values['hour'] == hour) {\n+\t\t\t\treturn;\n+\t\t\t}\n+\t\t\tthis.set('value', hour+':'+minute+':'+second);\n+\t\t},\n+\n+\t\t/**\n+\t\t* @private\n+\t\t*/\n+\t\tpickerExpired: function () {\n+\t\t\tthis.cancelPicker();\n+\t\t\tthis.doPickerExpired({name:this.name});\n+\t\t},\n+\n+\t\t/**\n+\t\t* @private\n+\t\t*/\n+\t\tcountdownChanged: function () {\n+\t\t\tthis.$.hour.set('disabled', this.countdown);\n+\t\t\tthis.$.minute.set('disabled', this.countdown);\n+\t\t\tthis.$.second.set('disabled' , this.countdown);\n+\t\t},\n+\n+\t\t/**\n+\t\t* @private\n+\t\t*/\n+\t\tstartTapped: function () {\n+\t\t\tif (this.pauseDisabled) {\n+\t\t\t\tif(this.values['hour'] || this.values['minute'] || this.values['second']) {\n+\t\t\t\t\tthis.set('startContent', cancelText);\n+\t\t\t\t\tthis.startPicker();\n+\t\t\t\t}\n+\t\t\t} else {\n+\t\t\t\tthis.set('value', '');\n+\t\t\t}\n+\t\t},\n+\n+\t\t/**\n+\t\t* @private\n+\t\t*/\n+\t\tpauseTapped: function () {\n+\t\t\tif (this.countdown) {\n+\t\t\t\tthis.set('pauseContent', resumeText);\n+\t\t\t\tthis.pauseTimer();\n+\t\t\t} else {\n+\t\t\t\tthis.set('pauseContent', pauseText);\n+\t\t\t\tthis.startTimer();\n+\t\t\t}\n+\t\t},\n+\n+\t\t/**\n+\t\t* @private\n+\t\t*/\n+\t\tstartPicker: function () {\n+\t\t\tthis.set('pauseDisabled', false);\n+\t\t\tthis.startTimer();\n+\t\t},\n+\n+\t\t/**\n+\t\t* @private\n+\t\t*/\n+\t\tcancelPicker: function () {\n+\t\t\tthis.set('startContent', startText);\n+\t\t\tthis.set('pauseContent', pauseText);\n+\t\t\tthis.set('pauseDisabled', true);\n+\t\t\tthis.pauseTimer();\n+\t\t},\n+\n+\t\t/**\n+\t\t* @private\n+\t\t*/\n+\t\tstartTimer: function () {\n+\t\t\tif (this.value) {\n+\t\t\t\tthis.timer = moon.setInterval(enyo.bind (this, function () {\n+\t\t\t\t\tthis.tick();\n+\t\t\t\t}), 1000);\n+\t\t\t\tthis.set('countdown', true);\n+\t\t\t}\n+\t\t},\n+\n+\t\t/**\n+\t\t* @private\n+\t\t*/\n+\t\tpauseTimer: function () {\n+\t\t\tthis.set('countdown', false);\n+\t\t\tmoon.clearInterval(this.timer);\n+\t\t},\n+\n+\t\t/**\n+\t\t* @private\n+\t\t*/\n+\t\thidePickers: function () {\n+\t\t\tthis.set('showHour', false);\n+\t\t\tthis.set('showMinute', false);\n+\t\t\tthis.set('showSecond', false);\n+\t\t},\n+\n+\t\t/**\n+\t\t* @private\n+\t\t*/\n+\t\tresetPicker: function () {\n+\t\t\tif (!this.pauseDisabled) {\n+\t\t\t\tthis.cancelPicker();\n+\t\t\t}\n+\t\t\tthis.values['hour'] = 0;\n+\t\t\tif (this.$.hour) this.$.hour.set('value', 0);\n+\n+\t\t\tthis.values['minute'] = 0;\n+\t\t\tif (this.$.minute) this.$.minute.set('value', 0);\n+\n+\t\t\tthis.values['second'] = 0;\n+\t\t\tif (this.$.second) this.$.second.set('value',0);\n+\t\t},\n+\n+\t\t/**\n+\t\t* @private\n+\t\t*/\n+\t\tclosePicker: function (sender, ev) {\n+\t\t\t/**\n+\t\t\t* If select/enter is pressed on any duration picker item close the drawer\n+\t\t\t*/\n+\t\t\tif (ev.type == 'onSpotlightSelect' ||\n+\t\t\t\tthis.$.client.children[0].id == ev.originator.id) {\n+\t\t\t\tthis.expandContract();\n+\t\t\t\treturn true;\n+\t\t\t}\n+\t\t},\n+\n+\t\t/**\n+\t\t* @private\n+\t\t*/\n+\t\ttoggleActive: function () {\n+\t\t\tif (this.get('open')) {\n+\t\t\t\tthis.set('active', false);\n+\t\t\t\tif (!enyo.Spotlight.getPointerMode()) {\n+\t\t\t\t\tenyo.Spotlight.spot(this.$.headerWrapper);\n+\t\t\t\t}\n+\t\t\t} else {\n+\t\t\t\tthis.set('active', true);\n+\t\t\t}\n+\t\t}\n+\t});\n+\n+\t(function () {\n+\t\t/* A replacement for window.setInterval() function, It use window.setTimeout() to perform the interval functionality\n+\t\t* It is based on enyo.perfNow() and use setInterval() and clearInterval() function as like with window\n+\t\t*\n+\t\t*/\n+\n+\t\t/* Interval Object */\n+\t\tvar Interval = function (func, delay) {","path":"source/DurationPicker.js","position":650,"original_position":650,"commit_id":"8bb96f620db95fa5f4b25bf2943de0524c51750b","original_commit_id":"8bb96f620db95fa5f4b25bf2943de0524c51750b","user":{"login":"aarontam","id":463191,"avatar_url":"https://avatars.githubusercontent.com/u/463191?v=3","gravatar_id":"","url":"https://api.github.com/users/aarontam","html_url":"https://github.com/aarontam","followers_url":"https://api.github.com/users/aarontam/followers","following_url":"https://api.github.com/users/aarontam/following{/other_user}","gists_url":"https://api.github.com/users/aarontam/gists{/gist_id}","starred_url":"https://api.github.com/users/aarontam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aarontam/subscriptions","organizations_url":"https://api.github.com/users/aarontam/orgs","repos_url":"https://api.github.com/users/aarontam/repos","events_url":"https://api.github.com/users/aarontam/events{/privacy}","received_events_url":"https://api.github.com/users/aarontam/received_events","type":"User","site_admin":false},"body":"Hi @anishlg, thanks for the clarification. I'm wondering if this shouldn't go into `enyo` core, maybe as part of `enyo.job` i.e. `enyo.repeatingJob`. It seems to be something that would be useful at a more general level, and could benefit from utilizing the job paradigm where a job can be named and a delay can be specified.\r\n\r\ncc @Djspaceg @clinuz ","created_at":"2015-03-20T17:52:54Z","updated_at":"2015-03-20T17:52:54Z","html_url":"https://github.com/enyojs/moonstone/pull/2031#discussion_r26860919","pull_request_url":"https://api.github.com/repos/enyojs/moonstone/pulls/2031","_links":{"self":{"href":"https://api.github.com/repos/enyojs/moonstone/pulls/comments/26860919"},"html":{"href":"https://github.com/enyojs/moonstone/pull/2031#discussion_r26860919"},"pull_request":{"href":"https://api.github.com/repos/enyojs/moonstone/pulls/2031"}}},"pull_request":{"url":"https://api.github.com/repos/enyojs/moonstone/pulls/2031","id":31408599,"html_url":"https://github.com/enyojs/moonstone/pull/2031","diff_url":"https://github.com/enyojs/moonstone/pull/2031.diff","patch_url":"https://github.com/enyojs/moonstone/pull/2031.patch","issue_url":"https://api.github.com/repos/enyojs/moonstone/issues/2031","number":2031,"state":"open","locked":false,"title":"ENYO-493: Duration Picker (hour, minute, second)","user":{"login":"anishlg","id":4177581,"avatar_url":"https://avatars.githubusercontent.com/u/4177581?v=3","gravatar_id":"","url":"https://api.github.com/users/anishlg","html_url":"https://github.com/anishlg","followers_url":"https://api.github.com/users/anishlg/followers","following_url":"https://api.github.com/users/anishlg/following{/other_user}","gists_url":"https://api.github.com/users/anishlg/gists{/gist_id}","starred_url":"https://api.github.com/users/anishlg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anishlg/subscriptions","organizations_url":"https://api.github.com/users/anishlg/orgs","repos_url":"https://api.github.com/users/anishlg/repos","events_url":"https://api.github.com/users/anishlg/events{/privacy}","received_events_url":"https://api.github.com/users/anishlg/received_events","type":"User","site_admin":false},"body":"updated the old duration picker\r\nhttps://github.com/enyojs/moonstone/pull/1978/","created_at":"2015-03-18T08:35:13Z","updated_at":"2015-03-20T17:52:54Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7094e0135785ad9862ae413980be095b6ded6c60","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/enyojs/moonstone/pulls/2031/commits","review_comments_url":"https://api.github.com/repos/enyojs/moonstone/pulls/2031/comments","review_comment_url":"https://api.github.com/repos/enyojs/moonstone/pulls/comments{/number}","comments_url":"https://api.github.com/repos/enyojs/moonstone/issues/2031/comments","statuses_url":"https://api.github.com/repos/enyojs/moonstone/statuses/8bb96f620db95fa5f4b25bf2943de0524c51750b","head":{"label":"enyojs:enyo-493-anishtd","ref":"enyo-493-anishtd","sha":"8bb96f620db95fa5f4b25bf2943de0524c51750b","user":{"login":"enyojs","id":1266337,"avatar_url":"https://avatars.githubusercontent.com/u/1266337?v=3","gravatar_id":"","url":"https://api.github.com/users/enyojs","html_url":"https://github.com/enyojs","followers_url":"https://api.github.com/users/enyojs/followers","following_url":"https://api.github.com/users/enyojs/following{/other_user}","gists_url":"https://api.github.com/users/enyojs/gists{/gist_id}","starred_url":"https://api.github.com/users/enyojs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/enyojs/subscriptions","organizations_url":"https://api.github.com/users/enyojs/orgs","repos_url":"https://api.github.com/users/enyojs/repos","events_url":"https://api.github.com/users/enyojs/events{/privacy}","received_events_url":"https://api.github.com/users/enyojs/received_events","type":"Organization","site_admin":false},"repo":{"id":7251076,"name":"moonstone","full_name":"enyojs/moonstone","owner":{"login":"enyojs","id":1266337,"avatar_url":"https://avatars.githubusercontent.com/u/1266337?v=3","gravatar_id":"","url":"https://api.github.com/users/enyojs","html_url":"https://github.com/enyojs","followers_url":"https://api.github.com/users/enyojs/followers","following_url":"https://api.github.com/users/enyojs/following{/other_user}","gists_url":"https://api.github.com/users/enyojs/gists{/gist_id}","starred_url":"https://api.github.com/users/enyojs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/enyojs/subscriptions","organizations_url":"https://api.github.com/users/enyojs/orgs","repos_url":"https://api.github.com/users/enyojs/repos","events_url":"https://api.github.com/users/enyojs/events{/privacy}","received_events_url":"https://api.github.com/users/enyojs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/enyojs/moonstone","description":"Moonstone UI library for TV user interfaces.","fork":false,"url":"https://api.github.com/repos/enyojs/moonstone","forks_url":"https://api.github.com/repos/enyojs/moonstone/forks","keys_url":"https://api.github.com/repos/enyojs/moonstone/keys{/key_id}","collaborators_url":"https://api.github.com/repos/enyojs/moonstone/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/enyojs/moonstone/teams","hooks_url":"https://api.github.com/repos/enyojs/moonstone/hooks","issue_events_url":"https://api.github.com/repos/enyojs/moonstone/issues/events{/number}","events_url":"https://api.github.com/repos/enyojs/moonstone/events","assignees_url":"https://api.github.com/repos/enyojs/moonstone/assignees{/user}","branches_url":"https://api.github.com/repos/enyojs/moonstone/branches{/branch}","tags_url":"https://api.github.com/repos/enyojs/moonstone/tags","blobs_url":"https://api.github.com/repos/enyojs/moonstone/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/enyojs/moonstone/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/enyojs/moonstone/git/refs{/sha}","trees_url":"https://api.github.com/repos/enyojs/moonstone/git/trees{/sha}","statuses_url":"https://api.github.com/repos/enyojs/moonstone/statuses/{sha}","languages_url":"https://api.github.com/repos/enyojs/moonstone/languages","stargazers_url":"https://api.github.com/repos/enyojs/moonstone/stargazers","contributors_url":"https://api.github.com/repos/enyojs/moonstone/contributors","subscribers_url":"https://api.github.com/repos/enyojs/moonstone/subscribers","subscription_url":"https://api.github.com/repos/enyojs/moonstone/subscription","commits_url":"https://api.github.com/repos/enyojs/moonstone/commits{/sha}","git_commits_url":"https://api.github.com/repos/enyojs/moonstone/git/commits{/sha}","comments_url":"https://api.github.com/repos/enyojs/moonstone/comments{/number}","issue_comment_url":"https://api.github.com/repos/enyojs/moonstone/issues/comments{/number}","contents_url":"https://api.github.com/repos/enyojs/moonstone/contents/{+path}","compare_url":"https://api.github.com/repos/enyojs/moonstone/compare/{base}...{head}","merges_url":"https://api.github.com/repos/enyojs/moonstone/merges","archive_url":"https://api.github.com/repos/enyojs/moonstone/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/enyojs/moonstone/downloads","issues_url":"https://api.github.com/repos/enyojs/moonstone/issues{/number}","pulls_url":"https://api.github.com/repos/enyojs/moonstone/pulls{/number}","milestones_url":"https://api.github.com/repos/enyojs/moonstone/milestones{/number}","notifications_url":"https://api.github.com/repos/enyojs/moonstone/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/enyojs/moonstone/labels{/name}","releases_url":"https://api.github.com/repos/enyojs/moonstone/releases{/id}","created_at":"2012-12-20T02:41:05Z","updated_at":"2015-03-20T06:15:36Z","pushed_at":"2015-03-20T10:42:36Z","git_url":"git://github.com/enyojs/moonstone.git","ssh_url":"git@github.com:enyojs/moonstone.git","clone_url":"https://github.com/enyojs/moonstone.git","svn_url":"https://github.com/enyojs/moonstone","homepage":"","size":87859,"stargazers_count":29,"watchers_count":29,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":10,"mirror_url":null,"open_issues_count":24,"forks":10,"open_issues":24,"watchers":29,"default_branch":"master"}},"base":{"label":"enyojs:master","ref":"master","sha":"78d51a3da611041fdaebf527a6af1b42daa40617","user":{"login":"enyojs","id":1266337,"avatar_url":"https://avatars.githubusercontent.com/u/1266337?v=3","gravatar_id":"","url":"https://api.github.com/users/enyojs","html_url":"https://github.com/enyojs","followers_url":"https://api.github.com/users/enyojs/followers","following_url":"https://api.github.com/users/enyojs/following{/other_user}","gists_url":"https://api.github.com/users/enyojs/gists{/gist_id}","starred_url":"https://api.github.com/users/enyojs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/enyojs/subscriptions","organizations_url":"https://api.github.com/users/enyojs/orgs","repos_url":"https://api.github.com/users/enyojs/repos","events_url":"https://api.github.com/users/enyojs/events{/privacy}","received_events_url":"https://api.github.com/users/enyojs/received_events","type":"Organization","site_admin":false},"repo":{"id":7251076,"name":"moonstone","full_name":"enyojs/moonstone","owner":{"login":"enyojs","id":1266337,"avatar_url":"https://avatars.githubusercontent.com/u/1266337?v=3","gravatar_id":"","url":"https://api.github.com/users/enyojs","html_url":"https://github.com/enyojs","followers_url":"https://api.github.com/users/enyojs/followers","following_url":"https://api.github.com/users/enyojs/following{/other_user}","gists_url":"https://api.github.com/users/enyojs/gists{/gist_id}","starred_url":"https://api.github.com/users/enyojs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/enyojs/subscriptions","organizations_url":"https://api.github.com/users/enyojs/orgs","repos_url":"https://api.github.com/users/enyojs/repos","events_url":"https://api.github.com/users/enyojs/events{/privacy}","received_events_url":"https://api.github.com/users/enyojs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/enyojs/moonstone","description":"Moonstone UI library for TV user interfaces.","fork":false,"url":"https://api.github.com/repos/enyojs/moonstone","forks_url":"https://api.github.com/repos/enyojs/moonstone/forks","keys_url":"https://api.github.com/repos/enyojs/moonstone/keys{/key_id}","collaborators_url":"https://api.github.com/repos/enyojs/moonstone/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/enyojs/moonstone/teams","hooks_url":"https://api.github.com/repos/enyojs/moonstone/hooks","issue_events_url":"https://api.github.com/repos/enyojs/moonstone/issues/events{/number}","events_url":"https://api.github.com/repos/enyojs/moonstone/events","assignees_url":"https://api.github.com/repos/enyojs/moonstone/assignees{/user}","branches_url":"https://api.github.com/repos/enyojs/moonstone/branches{/branch}","tags_url":"https://api.github.com/repos/enyojs/moonstone/tags","blobs_url":"https://api.github.com/repos/enyojs/moonstone/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/enyojs/moonstone/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/enyojs/moonstone/git/refs{/sha}","trees_url":"https://api.github.com/repos/enyojs/moonstone/git/trees{/sha}","statuses_url":"https://api.github.com/repos/enyojs/moonstone/statuses/{sha}","languages_url":"https://api.github.com/repos/enyojs/moonstone/languages","stargazers_url":"https://api.github.com/repos/enyojs/moonstone/stargazers","contributors_url":"https://api.github.com/repos/enyojs/moonstone/contributors","subscribers_url":"https://api.github.com/repos/enyojs/moonstone/subscribers","subscription_url":"https://api.github.com/repos/enyojs/moonstone/subscription","commits_url":"https://api.github.com/repos/enyojs/moonstone/commits{/sha}","git_commits_url":"https://api.github.com/repos/enyojs/moonstone/git/commits{/sha}","comments_url":"https://api.github.com/repos/enyojs/moonstone/comments{/number}","issue_comment_url":"https://api.github.com/repos/enyojs/moonstone/issues/comments{/number}","contents_url":"https://api.github.com/repos/enyojs/moonstone/contents/{+path}","compare_url":"https://api.github.com/repos/enyojs/moonstone/compare/{base}...{head}","merges_url":"https://api.github.com/repos/enyojs/moonstone/merges","archive_url":"https://api.github.com/repos/enyojs/moonstone/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/enyojs/moonstone/downloads","issues_url":"https://api.github.com/repos/enyojs/moonstone/issues{/number}","pulls_url":"https://api.github.com/repos/enyojs/moonstone/pulls{/number}","milestones_url":"https://api.github.com/repos/enyojs/moonstone/milestones{/number}","notifications_url":"https://api.github.com/repos/enyojs/moonstone/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/enyojs/moonstone/labels{/name}","releases_url":"https://api.github.com/repos/enyojs/moonstone/releases{/id}","created_at":"2012-12-20T02:41:05Z","updated_at":"2015-03-20T06:15:36Z","pushed_at":"2015-03-20T10:42:36Z","git_url":"git://github.com/enyojs/moonstone.git","ssh_url":"git@github.com:enyojs/moonstone.git","clone_url":"https://github.com/enyojs/moonstone.git","svn_url":"https://github.com/enyojs/moonstone","homepage":"","size":87859,"stargazers_count":29,"watchers_count":29,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":10,"mirror_url":null,"open_issues_count":24,"forks":10,"open_issues":24,"watchers":29,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/enyojs/moonstone/pulls/2031"},"html":{"href":"https://github.com/enyojs/moonstone/pull/2031"},"issue":{"href":"https://api.github.com/repos/enyojs/moonstone/issues/2031"},"comments":{"href":"https://api.github.com/repos/enyojs/moonstone/issues/2031/comments"},"review_comments":{"href":"https://api.github.com/repos/enyojs/moonstone/pulls/2031/comments"},"review_comment":{"href":"https://api.github.com/repos/enyojs/moonstone/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/enyojs/moonstone/pulls/2031/commits"},"statuses":{"href":"https://api.github.com/repos/enyojs/moonstone/statuses/8bb96f620db95fa5f4b25bf2943de0524c51750b"}}}}