-
Notifications
You must be signed in to change notification settings - Fork 56
Open
Description
idea
I would like to propose an API for papers to communicate with each other by sending events.
The idea came from a usecase like in this tweet - basically a setup in which one has a keyboard-paper that emits events (e.g. keypress) and sends them to another paper, which can then handle those events.
the API
The API would look similar to that of the Node Event API. A paper could emit events like so:
/* paper.emit(eventname, paperNumber, data) */
paper.emit('keypress', '123', {key: 'a'})
with the second parameter specifying the paper to which you want to send the event. Alternatively one could also have a broadcast method if one wanted to send an event to all papers:
paper.broadcast('keypress', {key: 'a'})
and handling of events would look like so:
paper.on('keypress', function(data) {
// do something
})
Any opinions on that?
Metadata
Metadata
Assignees
Labels
No labels