mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-28 18:00:09 +00:00
tweaking...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
9831b863ea
commit
0a3140f888
@ -2442,7 +2442,7 @@ function(title, func){
|
|||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
var makeTaskAction =
|
var makeTaskAction =
|
||||||
function(name, state, callback){
|
function(name, from, to, callback){
|
||||||
return function(title, task='all'){
|
return function(title, task='all'){
|
||||||
title = title == '*' || title == 'all' ?
|
title = title == '*' || title == 'all' ?
|
||||||
[...(this.__running_tasks || new Map()).keys()]
|
[...(this.__running_tasks || new Map()).keys()]
|
||||||
@ -2454,17 +2454,24 @@ function(name, state, callback){
|
|||||||
.forEach(function(title){
|
.forEach(function(title){
|
||||||
[...(this.__running_tasks || new Map()).get(title) || []]
|
[...(this.__running_tasks || new Map()).get(title) || []]
|
||||||
.forEach(function(t){
|
.forEach(function(t){
|
||||||
|
// filter task...
|
||||||
;(task == 'all'
|
;(task == 'all'
|
||||||
|| task == '*'
|
|| task == '*'
|
||||||
|| task === t
|
|| task === t
|
||||||
|| (task instanceof Array
|
|| (task instanceof Array
|
||||||
&& task.includes(t)))
|
&& task.includes(t)))
|
||||||
|
// filter states...
|
||||||
|
&& (from == '*'
|
||||||
|
|| from == 'all'
|
||||||
|
|| t.state == from)
|
||||||
|
// XXX do we retrigger???
|
||||||
|
//&& t.state != to
|
||||||
// call handler...
|
// call handler...
|
||||||
&& t[name]
|
&& t[name]
|
||||||
&& t[name]() !== false
|
&& t[name]() !== false
|
||||||
// state...
|
// state...
|
||||||
&& state
|
&& to
|
||||||
&& (t.state = state) })
|
&& (t.state = to) })
|
||||||
callback
|
callback
|
||||||
&& callback.call(this, title, task) }.bind(this))
|
&& callback.call(this, title, task) }.bind(this))
|
||||||
// cleanup...
|
// cleanup...
|
||||||
@ -2501,6 +2508,8 @@ var TaskActions = actions.Actions({
|
|||||||
// XXX might be a good idea to make this compatible with tasks.Queue(..)
|
// XXX might be a good idea to make this compatible with tasks.Queue(..)
|
||||||
// ...and return a queue if not task is given??
|
// ...and return a queue if not task is given??
|
||||||
Task: ['- System/',
|
Task: ['- System/',
|
||||||
|
doc`
|
||||||
|
`,
|
||||||
function(title, task){
|
function(title, task){
|
||||||
// reserved titles...
|
// reserved titles...
|
||||||
if(title == 'all' || title == '*'){
|
if(title == 'all' || title == '*'){
|
||||||
@ -2572,17 +2581,20 @@ var TaskActions = actions.Actions({
|
|||||||
get tasks(){
|
get tasks(){
|
||||||
return this.actions.filter(function(action){
|
return this.actions.filter(function(action){
|
||||||
return !!this.getActionAttr(action, '__task__') }.bind(this)) },
|
return !!this.getActionAttr(action, '__task__') }.bind(this)) },
|
||||||
get running(){
|
|
||||||
|
get tasksActive(){
|
||||||
|
return this.getTasks() },
|
||||||
|
get tasksRunning(){
|
||||||
return this.getTasks('all', 'running') },
|
return this.getTasks('all', 'running') },
|
||||||
get paused(){
|
get tasksPaused(){
|
||||||
return this.getTasks('all', 'paused') },
|
return this.getTasks('all', 'paused') },
|
||||||
|
|
||||||
pause: ['- System/',
|
pauseTask: ['- System/',
|
||||||
makeTaskAction('pause', 'paused')],
|
makeTaskAction('pause', 'running', 'paused')],
|
||||||
resume: ['- System/',
|
resumeTask: ['- System/',
|
||||||
makeTaskAction('resume', 'running')],
|
makeTaskAction('resume', 'paused', 'running')],
|
||||||
_abort: ['- System/',
|
abortTask: ['- System/',
|
||||||
makeTaskAction('abort', null,
|
makeTaskAction('abort', 'all', null,
|
||||||
function(title, task='all'){
|
function(title, task='all'){
|
||||||
this.__running_tasks
|
this.__running_tasks
|
||||||
&& (task == 'all'
|
&& (task == 'all'
|
||||||
|
|||||||
@ -156,6 +156,13 @@ module.QueueActions = actions.Actions(QueuePrototype, {
|
|||||||
: e[0] == tag && e[1] === task){
|
: e[0] == tag && e[1] === task){
|
||||||
delete ready[i]
|
delete ready[i]
|
||||||
that.taskDropped(e[0], e[1], e[2]) } }) }],
|
that.taskDropped(e[0], e[1], e[2]) } }) }],
|
||||||
|
// prioritize tasks by bumping them to start of queue...
|
||||||
|
// XXX
|
||||||
|
prioritize: ['',
|
||||||
|
function(){
|
||||||
|
// XXX
|
||||||
|
}],
|
||||||
|
// delay tasks by pushing then to end of queue...
|
||||||
delay: ['',
|
delay: ['',
|
||||||
function(a, b){
|
function(a, b){
|
||||||
var ready = this.__ready
|
var ready = this.__ready
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user