mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 10:20:08 +00:00
some refactoring...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
1c29da7ee7
commit
59dc0d01c5
@ -571,6 +571,9 @@ var FileSystemLoaderActions = actions.Actions({
|
||||
method: 'loadImages',
|
||||
}
|
||||
})
|
||||
.then(function(){
|
||||
delete that.changes
|
||||
})
|
||||
})
|
||||
}],
|
||||
|
||||
|
||||
@ -54,31 +54,39 @@ var RecoverActions = actions.Actions({
|
||||
// parent actions at this point...
|
||||
loadOrRecover: ['- Location/',
|
||||
function(data){
|
||||
var that = this
|
||||
return new Promise(function(resolve, reject){
|
||||
// this is the critical section, after this point we
|
||||
// are doing the actual loading....
|
||||
try {
|
||||
|
||||
this.load(data)
|
||||
that.load(data)
|
||||
|
||||
resolve(data)
|
||||
|
||||
// something bad happened, clear and handle it...
|
||||
} catch(err){
|
||||
this.clear()
|
||||
that.clear()
|
||||
|
||||
console.error(err)
|
||||
|
||||
// recover to last location...
|
||||
if(this.__recover){
|
||||
this.recover()
|
||||
if(that.__recover){
|
||||
that.recover()
|
||||
|
||||
reject('recovered')
|
||||
|
||||
// fail...
|
||||
} else {
|
||||
// clear the recovery data...
|
||||
delete this.__recover
|
||||
delete that.__recover
|
||||
|
||||
// fail...
|
||||
throw err
|
||||
//throw err
|
||||
reject(err)
|
||||
}
|
||||
}
|
||||
})
|
||||
}],
|
||||
|
||||
// Recover from load error...
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user