Skip to content
This repository has been archived by the owner on May 25, 2019. It is now read-only.

locatorObj.ready could be a promise fulfilled after parseBundle() is done #14

Open
caridy opened this issue Sep 12, 2013 · 5 comments
Open
Assignees

Comments

@caridy
Copy link
Contributor

caridy commented Sep 12, 2013

// locator initialization
var locator = new Locator({
    buildDirectory: 'build'
});

locator.plug(pluginOne())
   .plug(pluginTwo())
   .plug(pluginThree())
   .parseBundle(__dirname, {});

locator.ready.then(function(have) {
    // do something...
});

this will facilitate passing locator instance around into different components that requires filesystem abstraction and let them know when locator is ready to be used.

related to modown trello card 203

@caridy
Copy link
Contributor Author

caridy commented Sep 12, 2013

I will also argue that the __dirname passed into parseBundle should be a property of the instance since we don't expect parseBundle to be called twice for a locator instance.

@isao
Copy link
Contributor

isao commented Sep 12, 2013

locatorObj.parseBundle() already returns the then. is a getter needed?

// current api
var locator = new Locator({
    buildDirectory: 'build'
});

var ready = locator.plug(pluginOne())
   .plug(pluginTwo())
   .plug(pluginThree())
   .parseBundle(__dirname, {});

// the "then" function
ready(function(have) {
    // do something...
});

@drewfish
Copy link
Contributor

Early on while developing the locator we were uncertain if parseBundle() would be called multiple times. Since now it's not intended to be, and instead is intended to be called once at the "root" directory it should perhaps be called parseAppRoot() or parseRootBundle().

@isao
Copy link
Contributor

isao commented Sep 12, 2013

@drewfish that sounds good (or maybe just parse, or exec, or something). also moving options from the parse method to the constructor where it makes sense, and making available some metadata available as @caridy suggests

@caridy
Copy link
Contributor Author

caridy commented Sep 16, 2013

when can we get this rolling?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants