Docs & stuff

This commit is contained in:
Chi Vinh Le
2017-07-22 00:05:36 +07:00
parent 6ea7e9d564
commit 7b1c0dfbaa
3 changed files with 7 additions and 2 deletions
+1 -1
View File
@@ -48,7 +48,7 @@ if (!window.opener) {
// Pass any events through our parent.
eventEmitter.onAny((eventName, value) => {
pym.sendMessage('eventEmitter', JSON.stringify({eventName, value}));
pym.sendMessage('event', JSON.stringify({eventName, value}));
});
// Add a redux listener to pass through all actions to our event emitter.
+2 -1
View File
@@ -174,7 +174,8 @@ function configurePymParent(pymParent, opts) {
window.open(url, '_blank').focus();
});
pymParent.onMessage('eventEmitter', (raw) => {
// Pass events from iframe to the event emitter
pymParent.onMessage('event', (raw) => {
const {eventName, value} = JSON.parse(raw);
eventEmitter.emit(eventName, value);
});
+4
View File
@@ -11,6 +11,10 @@ export function injectReducers(reducers) {
store.replaceReducer(combineReducers(store.coralReducers));
}
/**
* Add a action listener to the redux store.
* The action is passed as the first argument to the callback.
*/
export function addListener(cb) {
listeners.push(cb);
}