GithubHelp home page GithubHelp logo

meteor-eventemitter's People

Contributors

arunoda avatar macrozone avatar trepafi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

meteor-eventemitter's Issues

Add feature: `emitState`

We lack an emitter to simulate a state an example could be the cordova ready event where we want to be notified when a state changes, if a state is already set we will run the listener at registration.

Another use case is for the raix:push package where a push message can be set before Meteor is even ready/after ready etc. So the message can be interpreted as a state, eg. we want to get the state and updates.

cc: @arunoda (If you have input or opinion about this)

Server -> Client Events?

Is ist possible to emit an event from the server and process it on the client? I am trying below. I have a setInterval running on my server to emit the number data to the client but doesn't seem to work. If I move my server code to the client it works perfectly. Not sure if this is possible or out of the scope of this package.

server.js
Meteor.startup(function(){ Event = new EventEmitter(); Meteor.setInterval(function(){ console.log("Emitting") Event.emit('game-spin', { number: 6 }) },2000); })

client.js
var listener; Meteor.startup(function(){ Event = new EventEmitter(); }) Template.gamePartial.onCreated(function() { listener = function(data) { console.log('Listening custom event', data); }; Event.on('game-spin', listener); }) Template.gamePartial.onDestroyed(function() { Event.removeListener('game-spin', listener); })

Why not just use Tracker?

It seems to me like wrapping a reactive variable in a Tracker.autorun accomplishes the exact same thing as an event emitter but with more declarative syntax as opposed to imperative syntax... Just curious when you'd want to use an event emitter as opposed to a reactive variable?

Template.events integration

It would be awesome if this would work seamlessly with Template events. That way they can automatically unsubscribe and it gives a very unified feel to the Template code...

More docs

Would be nice to get some more docs and examples or guides.

basic event

can a server event quickly show on the client ?

  1. server event 'we have data'
  2. client gets event -> gets data

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.