Storing temporary state


#1

For git-log package, I am providing a select list to select the repo and once it is selected i am using the handler registered using addOpener to create a new class and open the new window

return atom.workspace.addOpener(function(uri) {
    ....
    var GitLogView = require('./git-log-view');
            return new GitLogView(host);
    confirmed: (item) ->
        @cancel()
        uri = "git-log://" + item.repo_name
        old_pane = atom.workspace.paneForURI(uri)
        old_pane.destroyItem old_pane.itemForURI(uri)  if old_pane
        atom.workspace.open uri

I want to pass the item to the class that is being created, so what is the right way to store this data and pass it.


#2

I’m not sure if this is what you mean, but atom.workspace.open takes an options dictionary parameter:

Those same options are then passed into the callback passed into workspace.addOpener as a second parameter.


#3

@jessegrosjean Thank you… It did look at that. but i did not think that it would pass the options object to the opener… because the addOpener does not say anything about the options but only about the uri.