mirror of
				https://github.com/flynx/ImageGrid.git
				synced 2025-10-30 19:00:09 +00:00 
			
		
		
		
	notes and docs...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
		
							parent
							
								
									328541a27b
								
							
						
					
					
						commit
						f4631e561f
					
				| @ -21,6 +21,25 @@ var object = require('lib/object') | |||||||
| /*********************************************************************/ | /*********************************************************************/ | ||||||
| // helpers...
 | // helpers...
 | ||||||
| 
 | 
 | ||||||
|  | // Cooperative promise object...
 | ||||||
|  | // 
 | ||||||
|  | // This is like a promise but is not resolved internally, rather this 
 | ||||||
|  | // resolves (is set) via a different promise of value passed to it via 
 | ||||||
|  | // the .set(..) method...
 | ||||||
|  | // 
 | ||||||
|  | // Example:
 | ||||||
|  | // 	// create a promise...
 | ||||||
|  | // 	var p = (new CooperativePromise())
 | ||||||
|  | // 		// bind normally...
 | ||||||
|  | // 		.then(function(){ .. })
 | ||||||
|  | // 		
 | ||||||
|  | // 	// this will resolve p and trigger all the .then(..) callbacks...
 | ||||||
|  | // 	p.set(new Promise(function(resolve, reject){ resolve() }))
 | ||||||
|  | // 	
 | ||||||
|  | // Note that .set(..) can be passed any value, passing a non-promise has
 | ||||||
|  | // the same effect as passing the same value to resolve(..) of a Promise
 | ||||||
|  | // object...
 | ||||||
|  | // 
 | ||||||
| // XXX can we make this an instance of Promise for passing the
 | // XXX can we make this an instance of Promise for passing the
 | ||||||
| // 		x instanceof Promise test???
 | // 		x instanceof Promise test???
 | ||||||
| var CooperativePromisePrototype = { | var CooperativePromisePrototype = { | ||||||
| @ -103,15 +122,6 @@ object.makeConstructor('CooperativePromise', | |||||||
| 
 | 
 | ||||||
| //---------------------------------------------------------------------
 | //---------------------------------------------------------------------
 | ||||||
| 	 | 	 | ||||||
| // XXX should this parse out the protocol???
 |  | ||||||
| // 		...technically we no longer need it....
 |  | ||||||
| /* |  | ||||||
| var makeProtocolHandiler = function(protocol, func){ |  | ||||||
| 	return function(id){ |  | ||||||
| 		return id.startsWith(protocol + ':') |  | ||||||
| 			&& func.apply(this, arguments) } }  |  | ||||||
| //*/
 |  | ||||||
| 
 |  | ||||||
| var makeProtocolHandiler = function(protocol, func){ | var makeProtocolHandiler = function(protocol, func){ | ||||||
| 	return function(id){ | 	return function(id){ | ||||||
| 		return id.startsWith(protocol + ':') | 		return id.startsWith(protocol + ':') | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user