mashlet event subscriptions - can't add or remove "eventSubscriptions"
Wed, 07/14/2010 - 16:56
glenn.adams
Offline
Joined: 05/18/2010
Points: 80
OK, I'm perplexed. Hopefully someone can explain what I'm seeing here in Presto Developer Edition...
Short Version: I have a custom mashlet that is subscribed to an event and responds correctly. I want to ADD an additional event to this mashlet, or CHANGE the event it responds to. So far, no matter how I have edited mashlets.json, the mashlet insists on staying subscribed to the one event I originally set it up for.
What do I have to do to change the event subscriptions?
Long Version: I have created a mashlet that responds to an event called "LocationSelected". This was simply a matter of adding an eventsSubscriptions line to mashlets.json and restarting presto:
"eventSubscriptions": ["LocationSelected"]
I learned this from the inter-mashlet communication sample linked in other threads. This worked fine, but now I've moved on in my development and would like the mashlet to respond to a second event, "StateSelected". OK, I found in the documentation that eventSubscriptions is just an array, even though the only examples are for a single event subscription, both the property name and the documentation look like multiple event subs are supported. So I add:
Tried changing the order: "eventSubscriptions": ["StateSelected","LocationSelected"]
No Change. tried changing the case of the event to "stateSelected" (this was previously used in a different mashlet). No Change - I can only get onLoctionSelected to fire.
Finally, I removed LocationSelection entirely and changed the subscription to something new:
"eventSubscriptions": ["MyStateSelected"]
After restarting Presto, onLocationSelected is STILL the only event that will fire. It's not even supposed to be subscribed anymore!
For a while I thought that I must be modifying the wrong copy of mashlets.json, but if I introduce a bug into the file, it will cause all mashlets to fail to load, so that's not my problem.
I've tried stoping the repository in addition to restarting Presto, and finally rebooting entirely. None of these actions seem to have any effect.
OK, I'm perplexed. Hopefully someone can explain what I'm seeing here in Presto Developer Edition...
Short Version: I have a custom mashlet that is subscribed to an event and responds correctly. I want to ADD an additional event to this mashlet, or CHANGE the event it responds to. So far, no matter how I have edited mashlets.json, the mashlet insists on staying subscribed to the one event I originally set it up for.
What do I have to do to change the event subscriptions?
Long Version: I have created a mashlet that responds to an event called "LocationSelected". This was simply a matter of adding an eventsSubscriptions line to mashlets.json and restarting presto:
"eventSubscriptions": ["LocationSelected"]
I learned this from the inter-mashlet communication sample linked in other threads. This worked fine, but now I've moved on in my development and would like the mashlet to respond to a second event, "StateSelected". OK, I found in the documentation that eventSubscriptions is just an array, even though the only examples are for a single event subscription, both the property name and the documentation look like multiple event subs are supported. So I add:
"eventSubscriptions": ["LocationSelected","StateSelected"]
onStateSelected will not fire.
Tried changing the order: "eventSubscriptions": ["StateSelected","LocationSelected"]
No Change. tried changing the case of the event to "stateSelected" (this was previously used in a different mashlet). No Change - I can only get onLoctionSelected to fire.
Finally, I removed LocationSelection entirely and changed the subscription to something new:
"eventSubscriptions": ["MyStateSelected"]
After restarting Presto, onLocationSelected is STILL the only event that will fire. It's not even supposed to be subscribed anymore!
For a while I thought that I must be modifying the wrong copy of mashlets.json, but if I introduce a bug into the file, it will cause all mashlets to fail to load, so that's not my problem.
I've tried stoping the repository in addition to restarting Presto, and finally rebooting entirely. None of these actions seem to have any effect.
Any help is appreciated!
Thanks, Glenn