mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-28 18:00:09 +00:00
some experimenting...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
debf550b0a
commit
29c701e999
@ -36,6 +36,7 @@ var TimersActions = actions.Actions({
|
||||
|
||||
__timeouts: null,
|
||||
__intervals: null,
|
||||
__persistent_intervals: null,
|
||||
|
||||
|
||||
// XXX should these be actions???
|
||||
@ -87,18 +88,68 @@ var TimersActions = actions.Actions({
|
||||
delete intervals[id]
|
||||
}],
|
||||
|
||||
// XXX start all on .start(..) and stop on .stop(..)...
|
||||
// XXX assert that func is a string...
|
||||
// ...wrap func...
|
||||
setPersistentInterval: ['- System/',
|
||||
function(id, func, ms){
|
||||
// XXX
|
||||
core.doc`
|
||||
|
||||
Restart interval id...
|
||||
.setPersistentInterval(id)
|
||||
|
||||
Save/start interval id...
|
||||
.setPersistentInterval(id, action, ms)
|
||||
|
||||
`,
|
||||
function(id, action, ms){
|
||||
var cfg =
|
||||
this.config['persistent-intervals'] =
|
||||
this.config['persistent-intervals'] || {}
|
||||
var intervals =
|
||||
this.__persistent_intervals =
|
||||
this.__persistent_intervals || {}
|
||||
|
||||
// get defaults...
|
||||
action = action ? action : cfg[id].action
|
||||
ms = ms ? ms : cfg[id].ms
|
||||
|
||||
// checks...
|
||||
if(!ms || !action){
|
||||
console.error('Persistent interval: both action and ms must be set.')
|
||||
return
|
||||
}
|
||||
if(typeof(action) != typeof('str')){
|
||||
console.error('Persistent interval: handler must be a string.')
|
||||
return
|
||||
}
|
||||
|
||||
id in intervals
|
||||
&& clearInterval(intervals[id])
|
||||
|
||||
cfg[id] = {
|
||||
action: action,
|
||||
ms: ms,
|
||||
}
|
||||
|
||||
timeouts[id] = setInterval(
|
||||
function(){ this.call(action) }.bind(this),
|
||||
ms || 0)
|
||||
}],
|
||||
// XXX
|
||||
clearPersistentInterval: ['- System/',
|
||||
function(id){
|
||||
var intervals = this.config['persistent-intervals'] = this.config['persistent-intervals'] || {}
|
||||
var intervals =
|
||||
this.__persistent_intervals =
|
||||
this.__persistent_intervals || {}
|
||||
clearInterval(intervals[id])
|
||||
delete intervals[id]
|
||||
delete this.config['persistent-intervals'][id]
|
||||
}],
|
||||
// XXX add start/restart/stop persistent actions...
|
||||
// to start all:
|
||||
// Object.keys(this.config['persistent-intervals'] || {})
|
||||
// .forEach(function(id){
|
||||
// this.setPersistentInterval(id) }.bind(this))
|
||||
// to stop all:
|
||||
// XXX
|
||||
})
|
||||
|
||||
var Timers =
|
||||
@ -111,9 +162,23 @@ module.Timers = core.ImageGridFeatures.Feature({
|
||||
],
|
||||
|
||||
actions: Timers,
|
||||
|
||||
// XXX start all on .start(..) and stop on .stop(..)...
|
||||
handlers: [
|
||||
// XXX should this be start or start???
|
||||
['start',
|
||||
function(){
|
||||
// XXX
|
||||
}],
|
||||
['stop',
|
||||
function(){
|
||||
// XXX
|
||||
}],
|
||||
],
|
||||
})
|
||||
|
||||
|
||||
|
||||
/*********************************************************************/
|
||||
// XXX move store to a separate module...
|
||||
|
||||
|
||||
@ -990,6 +990,7 @@ var UIIntrospectionActions = actions.Actions({
|
||||
// Show doc for action...
|
||||
//
|
||||
// XXX STUB...
|
||||
// XXX handle non-action methods...
|
||||
// XXX this needs to:
|
||||
// - be a widget
|
||||
// - handle focus
|
||||
|
||||
8
ui (gen4)/package-lock.json
generated
8
ui (gen4)/package-lock.json
generated
@ -931,9 +931,9 @@
|
||||
"integrity": "sha512-oTZqweIP51xaGPI4uPa56/Pri/480R+mo7SeU+YETByQNhDG55ycFyNLIgta9vXhILrxXDmF7ZGhqZIcuN0gJQ=="
|
||||
},
|
||||
"ig-actions": {
|
||||
"version": "3.12.0",
|
||||
"resolved": "https://registry.npmjs.org/ig-actions/-/ig-actions-3.12.0.tgz",
|
||||
"integrity": "sha512-9fRwJKN2K9lP87NS5Cagdp5CEu/Z4CYF59dv++1IjNkvGmrpgHV41nSSW90vk8p1yKlu3zBV6+i7suLFljT90g==",
|
||||
"version": "3.14.0",
|
||||
"resolved": "https://registry.npmjs.org/ig-actions/-/ig-actions-3.14.0.tgz",
|
||||
"integrity": "sha512-ZKKAMGee+/yJz0Arfc9ZHP14mgEu7Z7MjlX205KzdXLLdvXgd5r6TGMZs6qo4jHqznAheIr5IeF0RcCq5MwGzA==",
|
||||
"requires": {
|
||||
"ig-object": "1.0.2"
|
||||
}
|
||||
@ -943,7 +943,7 @@
|
||||
"resolved": "https://registry.npmjs.org/ig-features/-/ig-features-3.3.2.tgz",
|
||||
"integrity": "sha512-NSvuVkLUI47f1mpG03/fVqJaMYLDUFVcg2FNXUtqvDqQqKhlZuXJfxsGcoFQ1eIZ1pqYcYeYHmjNbgmK6rT5cA==",
|
||||
"requires": {
|
||||
"ig-actions": "3.12.0",
|
||||
"ig-actions": "3.14.0",
|
||||
"ig-object": "1.0.2"
|
||||
}
|
||||
},
|
||||
|
||||
@ -26,7 +26,7 @@
|
||||
"fs-walk": "^0.0.1",
|
||||
"glob": "^4.0.6",
|
||||
"guarantee-events": "^1.0.0",
|
||||
"ig-actions": "^3.12.0",
|
||||
"ig-actions": "^3.14.0",
|
||||
"ig-features": "^3.3.2",
|
||||
"ig-object": "^1.0.2",
|
||||
"moment": "^2.20.1",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user