mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 18:30:09 +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',
|
method: 'loadImages',
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
.then(function(){
|
||||||
|
delete that.changes
|
||||||
|
})
|
||||||
})
|
})
|
||||||
}],
|
}],
|
||||||
|
|
||||||
|
|||||||
@ -54,31 +54,39 @@ var RecoverActions = actions.Actions({
|
|||||||
// parent actions at this point...
|
// parent actions at this point...
|
||||||
loadOrRecover: ['- Location/',
|
loadOrRecover: ['- Location/',
|
||||||
function(data){
|
function(data){
|
||||||
|
var that = this
|
||||||
|
return new Promise(function(resolve, reject){
|
||||||
// this is the critical section, after this point we
|
// this is the critical section, after this point we
|
||||||
// are doing the actual loading....
|
// are doing the actual loading....
|
||||||
try {
|
try {
|
||||||
|
|
||||||
this.load(data)
|
that.load(data)
|
||||||
|
|
||||||
|
resolve(data)
|
||||||
|
|
||||||
// something bad happened, clear and handle it...
|
// something bad happened, clear and handle it...
|
||||||
} catch(err){
|
} catch(err){
|
||||||
this.clear()
|
that.clear()
|
||||||
|
|
||||||
console.error(err)
|
console.error(err)
|
||||||
|
|
||||||
// recover to last location...
|
// recover to last location...
|
||||||
if(this.__recover){
|
if(that.__recover){
|
||||||
this.recover()
|
that.recover()
|
||||||
|
|
||||||
|
reject('recovered')
|
||||||
|
|
||||||
// fail...
|
// fail...
|
||||||
} else {
|
} else {
|
||||||
// clear the recovery data...
|
// clear the recovery data...
|
||||||
delete this.__recover
|
delete that.__recover
|
||||||
|
|
||||||
// fail...
|
// fail...
|
||||||
throw err
|
//throw err
|
||||||
|
reject(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
})
|
||||||
}],
|
}],
|
||||||
|
|
||||||
// Recover from load error...
|
// Recover from load error...
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user