Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
// In some app (say, a flickr-image-app):
appApi.emit('image-selected-for-upload', { url: someUrl, source: 'flickr' })
appApi.on('image-uploaded', function(e) {
if (e.data.source !== 'flickr') {
return;
}
alert('Image uploaded');
});
// In some other app (Imbo, for instance):
appApi.on('image-selected-for-upload', function(e) {
imbo.addImageFromUrl(e.data.url, function(err, response) {
if (err) {
return console.error(err);
}
appApi.emit('image-uploaded', { source: e.source });
});
});
// Which also would allow multiple apps to both emit and listen for events in an intuitive manner
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.