removed the last of the control-flow setTimeout's from browse.js...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2017-01-20 20:37:11 +03:00
parent 89668fc080
commit 37f601f77b
2 changed files with 20 additions and 18 deletions

View File

@ -921,7 +921,9 @@ var FileSystemLoaderUIActions = actions.Actions({
var so = that.Overlay( var so = that.Overlay(
browse.makeList(null, loaders, browse.makeList(null, loaders,
{ {
path: Object.keys(loaders)[0] // select first...
//path: Object.keys(loaders)[0],
path: 0,
}) })
// close self and parent... // close self and parent...
.open(function(){ .open(function(){

View File

@ -133,6 +133,7 @@ function(text, options){
// ... // ...
// } // }
// //
// NOTE: this need selection enabled in CSS...
Items.Selected = Items.Selected =
function(text, options){ function(text, options){
var elem = (options.action ? this.Action : this).call(this, text, options) var elem = (options.action ? this.Action : this).call(this, text, options)
@ -2869,23 +2870,22 @@ var BrowserPrototype = {
} }
// load the initial state... // load the initial state...
// // NOTE: path can be a number so simply or-ing here is a bad idea...
// NOTE: this used to be run in the timeout below, it turned out var path = options.path != null ? options.path : that.path
// to be a really bad idea mainly because the events bound typeof(path) == typeof(123) ?
// in .list(..) turned out to be bound AFTER the events bound // select item number...
// in the function that called the constructor, which messed that
// up the triggering order... .update()
that.update(options.path || that.path || '/') .then(function(){
that.select(path) })
// Select the default path... // select path...
// : that
// NOTE: this may not work when the dialog is loaded async... .update(path || '/')
setTimeout(function(){ // Select the default path...
// in case we have a manually selected item but that was .then(function(){
// not aligned... // in case we have a manually selected item but that was
that.selected && that.select() // not aligned...
}, 0) that.selected && that.select() })
}, },
} }