Events and broadcasting / listening in other "kinds"

I might be having trouble with events. I setup the moonstone tutorial application and tried to move the results list to a new panel instead of displaying inside the searchPanel. I thought I would be able to have a listener in the new panel:

handlers: { onInputHeaderChange: "search" },

I also thought that when the search bar changed, I could call the search method defined in the new panel (or call the search method in the current object and push the $.resultList to another panel.

// on change, set the input text to the search collection's searchText property search: function(inSender, inEvent) { /* * setting searchText kicks off a fetch of the flickr.SearchCollection via the flickr.Store, * using the parameters passed from the collection */ this.$.resultList.collection.set("searchText", inEvent.originator.get("value")); },

I am thinking in terms of Angular where I can broadcast to different controllers.

Is this enough of an explanation to give me a better idea of events?


  • The wiki doc on Event handling might help a bit. In short, if you need to communicate state between two components that do not have a direct relationship (e.g. one is owned by the other), events can pass the state up the hierarchy and properties/methods can pass it down.

    If you need to communicate between components that don't have a "nearby" common ancestor, you can use enyo.Signals to publish the event which will be received by all subscribers of the event. Use sparingly, in my opinion.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!