mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 18:30:09 +00:00
removed the external promise dependency as it was flacky + it was simpler to remove than to investigate with the existing native Promises now...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
ed9018b641
commit
69f60c1a7e
@ -21,9 +21,9 @@ var base = require('features/base')
|
|||||||
|
|
||||||
var AppControlActions = actions.Actions({
|
var AppControlActions = actions.Actions({
|
||||||
config: {
|
config: {
|
||||||
'application-window': null,
|
|
||||||
|
|
||||||
'window-title': 'ImageGrid.Viewer (${VERSION}): ${FILENAME}',
|
'window-title': 'ImageGrid.Viewer (${VERSION}): ${FILENAME}',
|
||||||
|
|
||||||
|
'window-delay-initial-display': 200,
|
||||||
},
|
},
|
||||||
|
|
||||||
// XXX revise these...
|
// XXX revise these...
|
||||||
@ -86,20 +86,23 @@ var AppControlActions = actions.Actions({
|
|||||||
this.centerViewer()
|
this.centerViewer()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
win.show()
|
|
||||||
|
|
||||||
// XXX check if we are full screen...
|
|
||||||
if(cfg != null && cfg.fullscreen && !win.isFullscreen){
|
|
||||||
this.toggleFullScreen('on')
|
|
||||||
}
|
|
||||||
|
|
||||||
/* XXX still buggy....
|
/* XXX still buggy....
|
||||||
// restore interface scale...
|
// restore interface scale...
|
||||||
this.toggleInterfaceScale(
|
this.toggleInterfaceScale(
|
||||||
this.config['ui-scale-mode']
|
this.config['ui-scale-mode']
|
||||||
|| this.toggleInterfaceScale('??')[0])
|
|| this.toggleInterfaceScale('??')[0])
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// NOTE: we delay this to enable the browser time to render
|
||||||
|
// things before we show them to the user...
|
||||||
|
setTimeout(function(){
|
||||||
|
win.show()
|
||||||
|
|
||||||
|
// XXX check if we are full screen...
|
||||||
|
if(cfg != null && cfg.fullscreen && !win.isFullscreen){
|
||||||
|
this.toggleFullScreen('on')
|
||||||
|
}
|
||||||
|
}, this.config['window-delay-initial-display'] || 0)
|
||||||
}],
|
}],
|
||||||
|
|
||||||
toggleFullScreen: ['Interface/Toggle full screen mode',
|
toggleFullScreen: ['Interface/Toggle full screen mode',
|
||||||
|
|||||||
@ -9,7 +9,6 @@ var events = require('events')
|
|||||||
|
|
||||||
var fse = require('fs-extra')
|
var fse = require('fs-extra')
|
||||||
var glob = require('glob')
|
var glob = require('glob')
|
||||||
var Promise = require('promise')
|
|
||||||
|
|
||||||
// XXX seems that we need different buids of this for use with node and nw...
|
// XXX seems that we need different buids of this for use with node and nw...
|
||||||
// XXX BUG: nw-gyp does not support msvs2015...
|
// XXX BUG: nw-gyp does not support msvs2015...
|
||||||
@ -95,10 +94,20 @@ function listJSON(path, pattern){
|
|||||||
return gGlob(path +'/'+ pattern +'.json')
|
return gGlob(path +'/'+ pattern +'.json')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// XXX move to someplace generic...
|
||||||
|
var denodeify = function(func){
|
||||||
|
return function(){
|
||||||
|
return new Promise(function(resolve, reject){
|
||||||
|
func.apply(null, args2array(arguments).concat([function(err, res){
|
||||||
|
err ? reject(err) : resolve(res)
|
||||||
|
}]))
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var loadFile = Promise.denodeify(fse.readFile)
|
var loadFile = denodeify(fse.readFile)
|
||||||
var writeFile = Promise.denodeify(fse.writeFile)
|
var writeFile = denodeify(fse.writeFile)
|
||||||
var ensureDir = Promise.denodeify(fse.ensureDir)
|
var ensureDir = denodeify(fse.ensureDir)
|
||||||
|
|
||||||
|
|
||||||
// XXX handle errors...
|
// XXX handle errors...
|
||||||
|
|||||||
@ -8,7 +8,6 @@ if(typeof(process) != 'undefined'){
|
|||||||
var os = require('os')
|
var os = require('os')
|
||||||
var fs = require('fs')
|
var fs = require('fs')
|
||||||
var path = require('path')
|
var path = require('path')
|
||||||
var promise = require('promise')
|
|
||||||
var glob = require('glob')
|
var glob = require('glob')
|
||||||
var guaranteeEvents = require('guarantee-events')
|
var guaranteeEvents = require('guarantee-events')
|
||||||
}
|
}
|
||||||
@ -19,7 +18,7 @@ define(function(require){ var module = {}
|
|||||||
// XXX HACK...
|
// XXX HACK...
|
||||||
// ...for some reason this gets loaded in browser...
|
// ...for some reason this gets loaded in browser...
|
||||||
if(typeof(process) == 'undefined'){
|
if(typeof(process) == 'undefined'){
|
||||||
return module
|
return modul
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -46,7 +45,7 @@ function(path, make){
|
|||||||
var fullpath = path.indexOf('*') >= 0
|
var fullpath = path.indexOf('*') >= 0
|
||||||
path = path.indexOf('*') < 0 ? path + '/*' : path
|
path = path.indexOf('*') < 0 ? path + '/*' : path
|
||||||
|
|
||||||
return new promise(function(resolve, reject){
|
return new Promise(function(resolve, reject){
|
||||||
// XXX do we need this???
|
// XXX do we need this???
|
||||||
/*guaranteeEvents([
|
/*guaranteeEvents([
|
||||||
'match',
|
'match',
|
||||||
@ -84,11 +83,17 @@ function(path, make){
|
|||||||
// XXX expose these as config...
|
// XXX expose these as config...
|
||||||
var fullpath = false
|
var fullpath = false
|
||||||
|
|
||||||
var stat = promise.denodeify(fs.stat)
|
var stat = function(path){
|
||||||
|
return new Promise(function(resolve, reject){
|
||||||
|
fs.stat.call(fs, path, function(err, res){
|
||||||
|
err ? reject(err) : resolve(res)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// get the drive list on windows...
|
// get the drive list on windows...
|
||||||
if(os.type() == 'Windows_NT' && path == '/'){
|
if(os.type() == 'Windows_NT' && path == '/'){
|
||||||
return new promise(function(resolve, reject){
|
return new Promise(function(resolve, reject){
|
||||||
// NOTE: this is a bit brain-dead but it gets the job done
|
// NOTE: this is a bit brain-dead but it gets the job done
|
||||||
// and faster than fancy modules like drivelist...
|
// and faster than fancy modules like drivelist...
|
||||||
'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
|
'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
|
||||||
@ -110,7 +115,7 @@ function(path, make){
|
|||||||
|
|
||||||
// list dirs...
|
// list dirs...
|
||||||
} else {
|
} else {
|
||||||
return new promise(function(resolve, reject){
|
return new Promise(function(resolve, reject){
|
||||||
// XXX should this be a promise???
|
// XXX should this be a promise???
|
||||||
fs.readdir(path, function(err, files){
|
fs.readdir(path, function(err, files){
|
||||||
// XXX
|
// XXX
|
||||||
@ -128,6 +133,14 @@ function(path, make){
|
|||||||
: file, null, true)
|
: file, null, true)
|
||||||
})
|
})
|
||||||
.then(function(res){
|
.then(function(res){
|
||||||
|
// can't read stat... (XXX ???)
|
||||||
|
if(res == null){
|
||||||
|
make(fullpath
|
||||||
|
? path +'/'+ file
|
||||||
|
: file, null, true)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
var dir = res.isDirectory()
|
var dir = res.isDirectory()
|
||||||
var elem = res && make(fullpath
|
var elem = res && make(fullpath
|
||||||
? path +'/'+ file
|
? path +'/'+ file
|
||||||
|
|||||||
@ -17,7 +17,6 @@
|
|||||||
"page-cache": true
|
"page-cache": true
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"promise": "*",
|
|
||||||
"commander": "^2.9.0",
|
"commander": "^2.9.0",
|
||||||
"exiftool": "0.0.3",
|
"exiftool": "0.0.3",
|
||||||
"flickrapi": "^0.3.28",
|
"flickrapi": "^0.3.28",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user