New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Events #785

Merged
merged 21 commits into from Jul 25, 2017

Conversation

Projects
None yet
4 participants
@cvle
Copy link
Member

cvle commented Jul 21, 2017

What does this PR do?

  • Introduce event emitter concept.
  • Add EventEmitterProvider and a withEmit HOC that provides a emit(eventName, value) property.
  • Integrate the GraphQL framework and redux into the event system
  • Allow passing a events property into Coral.Talk.render options to support listening to events
{
   // The argument passed is the event emitter from https://github.com/asyncly/EventEmitter2
   events: function(events) {
     events.onAny(function(eventName, data) {
       // logs all available events.
       console.log(eventName, data);
    });
  },
}

How do I test this PR?

  • Uncomment the example config in views/article.ejs and see the events flowing into the console :-)

@cvle cvle requested a review from okbel Jul 21, 2017

@kgardnr kgardnr added the in progress label Jul 24, 2017

@cvle cvle removed the in progress label Jul 25, 2017

@okbel

okbel approved these changes Jul 25, 2017

Copy link
Member

okbel left a comment

This is 😍

@@ -12,13 +14,19 @@ import 'react-mdl/extra/material.js';
import './graphql';
import {loadPluginsTranslations, injectPluginsReducers} from 'coral-framework/helpers/plugins';

const eventEmitter = new EventEmitter();

// TODO: pass redux actions through the emitter.

This comment has been minimized.

@okbel

okbel Jul 25, 2017

Member

Is this TODO up to date?

This comment has been minimized.

@cvle

cvle Jul 25, 2017

Member

Yes, I'd love to add that after we are able to use the store service from coral-framework so I don't have to write duplicate code...

This comment has been minimized.

@okbel

okbel Jul 25, 2017

Member

👍

@kgardnr kgardnr merged commit 49943dd into master Jul 25, 2017

1 check passed

ci/circleci Your tests passed on CircleCI!
Details

@kgardnr kgardnr deleted the event-emitter branch Jul 25, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment