mirror of
				https://github.com/flynx/ImageGrid.git
				synced 2025-10-30 10:50:08 +00:00 
			
		
		
		
	started work on tasks + cleanup of action introspection...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
		
							parent
							
								
									11fd3048dc
								
							
						
					
					
						commit
						c99338782e
					
				| @ -544,6 +544,7 @@ module.Base = core.ImageGridFeatures.Feature({ | |||||||
| 	suggested: [ | 	suggested: [ | ||||||
| 		'tags', | 		'tags', | ||||||
| 		'sort', | 		'sort', | ||||||
|  | 		'tasks', | ||||||
| 	], | 	], | ||||||
| 	*/ | 	*/ | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -48,10 +48,15 @@ function(attr, states, a, b){ | |||||||
| 
 | 
 | ||||||
| /*********************************************************************/ | /*********************************************************************/ | ||||||
| 
 | 
 | ||||||
|  | // Root ImageGrid.viewer object...
 | ||||||
|  | //
 | ||||||
| var ImageGridFeatures = | var ImageGridFeatures = | ||||||
| module.ImageGridFeatures = Object.create(features.FeatureSet) | module.ImageGridFeatures = Object.create(features.FeatureSet) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | //---------------------------------------------------------------------
 | ||||||
|  | // Setup runtime info...
 | ||||||
|  | 
 | ||||||
| // nw or node...
 | // nw or node...
 | ||||||
| if(typeof(process) != 'undefined'){ | if(typeof(process) != 'undefined'){ | ||||||
| 
 | 
 | ||||||
| @ -96,6 +101,7 @@ if(typeof(process) != 'undefined'){ | |||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| /*********************************************************************/ | /*********************************************************************/ | ||||||
|  | // System life-cycle...
 | ||||||
| 
 | 
 | ||||||
| // XXX should this be a generic library thing???
 | // XXX should this be a generic library thing???
 | ||||||
| // XXX should his have state???
 | // XXX should his have state???
 | ||||||
| @ -213,6 +219,7 @@ module.LifeCycle = ImageGridFeatures.Feature({ | |||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| //---------------------------------------------------------------------
 | //---------------------------------------------------------------------
 | ||||||
|  | // Workspace...
 | ||||||
| //
 | //
 | ||||||
| // Basic protocol:
 | // Basic protocol:
 | ||||||
| // 	A participating feature should:
 | // 	A participating feature should:
 | ||||||
| @ -368,6 +375,63 @@ module.Workspace = ImageGridFeatures.Feature({ | |||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | //---------------------------------------------------------------------
 | ||||||
|  | // Tasks...
 | ||||||
|  | // XXX should this be a separate module???
 | ||||||
|  | 
 | ||||||
|  | var tasks = require('lib/tasks') | ||||||
|  | 
 | ||||||
|  | // XXX see if a protocol can be practical here to:
 | ||||||
|  | // 		- serialize/restore jobs
 | ||||||
|  | // 		- ...
 | ||||||
|  | var TaskActions = actions.Actions({ | ||||||
|  | 	config: { | ||||||
|  | 	}, | ||||||
|  | 
 | ||||||
|  | 	get jobs(){ | ||||||
|  | 		return this.__jobs | ||||||
|  | 	}, | ||||||
|  | 
 | ||||||
|  | 	getJob: ['- Jobs/', | ||||||
|  | 		function(name){ | ||||||
|  | 			name = name || this.data.newGid() | ||||||
|  | 
 | ||||||
|  | 			// get/init task dict...
 | ||||||
|  | 			var t = this.__jobs = this.__jobs || {} | ||||||
|  | 			// get/init task...
 | ||||||
|  | 			var job = t[name] = t[name] || tasks.Queue() | ||||||
|  | 			job.name = name | ||||||
|  | 
 | ||||||
|  | 			return job | ||||||
|  | 		}], | ||||||
|  | 
 | ||||||
|  | 	// XXX stop
 | ||||||
|  | }) | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | var Tasks =  | ||||||
|  | module.Tasks = ImageGridFeatures.Feature({ | ||||||
|  | 	title: '', | ||||||
|  | 
 | ||||||
|  | 	tag: 'tasks', | ||||||
|  | 
 | ||||||
|  | 	depends: [ ], | ||||||
|  | 
 | ||||||
|  | 	actions: TaskActions, | ||||||
|  | 
 | ||||||
|  | 	handlers: [ | ||||||
|  | 		['start',  | ||||||
|  | 			function(){  | ||||||
|  | 				// XXX prepare for recovery and recover...
 | ||||||
|  | 			}], | ||||||
|  | 		['stop',  | ||||||
|  | 			function(){  | ||||||
|  | 				// XXX stop tasks and prepare for recovery...
 | ||||||
|  | 			}], | ||||||
|  | 	], | ||||||
|  | }) | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| 
 | 
 | ||||||
| /********************************************************************** | /********************************************************************** | ||||||
| * vim:set ts=4 sw=4 :                                                */ | * vim:set ts=4 sw=4 :                                                */ | ||||||
|  | |||||||
| @ -375,6 +375,7 @@ module.FileSystemLoader = core.ImageGridFeatures.Feature({ | |||||||
| 	tag: 'fs-loader', | 	tag: 'fs-loader', | ||||||
| 	depends: [ | 	depends: [ | ||||||
| 		'location', | 		'location', | ||||||
|  | 		'tasks', | ||||||
| 	], | 	], | ||||||
| 	suggested: [ | 	suggested: [ | ||||||
| 		'ui-fs-loader', | 		'ui-fs-loader', | ||||||
|  | |||||||
| @ -478,7 +478,8 @@ module.MetaActions = { | |||||||
| 		var handler = typeof(c) == 'function' ? c : b | 		var handler = typeof(c) == 'function' ? c : b | ||||||
| 		var tag = typeof(c) == 'function' ? b : c | 		var tag = typeof(c) == 'function' ? b : c | ||||||
| 
 | 
 | ||||||
| 		actions = typeof(actions) == 'string' ? actions.split(' ') : actions | 		// XXX make this split by whitespace...
 | ||||||
|  | 		actions = typeof(actions) == 'string' ? actions.split(/ +/) : actions | ||||||
| 
 | 
 | ||||||
| 		var that = this | 		var that = this | ||||||
| 		actions.forEach(function(action){ | 		actions.forEach(function(action){ | ||||||
| @ -498,7 +499,7 @@ module.MetaActions = { | |||||||
| 				// 		via. .off(..)
 | 				// 		via. .off(..)
 | ||||||
| 				a_handler.orig_handler = old_handler.orig_handler || old_handler | 				a_handler.orig_handler = old_handler.orig_handler || old_handler | ||||||
| 
 | 
 | ||||||
| 			// mot pre mode...
 | 			// not pre mode...
 | ||||||
| 			} else if(mode != 'pre') { | 			} else if(mode != 'pre') { | ||||||
| 				// XXX
 | 				// XXX
 | ||||||
| 				throw 'Unknown action mode: '+action+'.'+mode | 				throw 'Unknown action mode: '+action+'.'+mode | ||||||
|  | |||||||
| @ -152,6 +152,8 @@ function(path, make){ | |||||||
| 				var res = [] | 				var res = [] | ||||||
| 
 | 
 | ||||||
| 				if(that.options.dotDirs){ | 				if(that.options.dotDirs){ | ||||||
|  | 					// NOTE: this sometimes gets reordered so we aren't 
 | ||||||
|  | 					// 		using it... (BUG?)
 | ||||||
| 					//			files.splice(0, 0, '.', '..')
 | 					//			files.splice(0, 0, '.', '..')
 | ||||||
| 					// NOTE: we are counting these here so as to ensure 
 | 					// NOTE: we are counting these here so as to ensure 
 | ||||||
| 					// 		they are always first and not delayed by some
 | 					// 		they are always first and not delayed by some
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user