Skip to content
This repository was archived by the owner on Mar 3, 2023. It is now read-only.
This repository was archived by the owner on Mar 3, 2023. It is now read-only.

Proposal: add a way for packages to communicate with one another #1136

Description

@benogle

I added an API to the status-bar. Other packages that want to use the status bar have a bit of an awkward time getting a handle on the statusBar object. For reference see: atom/grammar-selector#2 Here's how it works now:

In the status bar, I do this:

statusBar=newStatusBarView()
atom.rootView.statusBar= statusBar

And in the package using status-bar:

# This is dumb:createStatusEntry=->view=newGrammarStatusView(atom.rootView.statusBar)
atom.rootView.statusBar.appendLeft(view)
ifatom.rootView.statusBarcreateStatusEntry()
elseatom.packages.once'activated', ->createStatusEntry()

I dont want to have every package author that wants to use something to the status bar to have to do this.

Proposal

I want to have some mechanism in one of the readily available objects (atom, rootView) for storage/retrieval of arbitrary objects. This is generally what I want to do:

In status-bar

statusBar=newStatusBarView()
atom.rootView.setChild('statusBar', statusBar)

In the package that uses status-bar

atom.rootView.getChild'statusBar', (statusBar) ->view=newGrammarStatusView(atom.rootView.statusBar)
atom.rootView.statusBar.appendLeft(view)

If statusBar is already there, it calls the callback, or it waits til statusBar is available.

I have no idea what to call these functions, and have no preference which object it should hang from.

Feedback, please.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions