Git Product home page Git Product logo

eev's People

Contributors

chrisdavies avatar danielkalen 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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

eev's Issues

What are safety guards to use this library?

Please advise what are safety guards using this library?
For example that only intended receiving application can process message from identified source application.
We are trying to use this library in micro-frontend applications

typings file

Hi,

Is there a eev.d.ts I can include in my typescript project?

I think this should be enough?

declare module Minute {
    class Eev {

        on(name: string, fn: Function);

        off(name: string, fn: Function);

        emit(name: string, data: Object);

        constructor();
    }
}

Thanks,
San

Eev.Eev is not a constructor

I'm working on an Angular 7 application, bundled with Webpack 4.
Inside a service file, I put the following code related to Eev

import * as Eev from 'eev';

export class RecipeService {
  // create an Eev instance
  e = new Eev.Eev();

  functionToEmitEvent(ingredients: Ingredient[]) {
    // add handler using Eev
    this.e.on('ingrToShopList', (data) => {
      console.log('Eev event ingrToShopList on');
      console.log('ingrToShopList data: ' + data);
    });
    this.e.emit('ingrToShopList', ingredients);
    this.e.off('ingrToShopList', (data) => {
      console.log('Eev event ingrToShopList off');
      console.log('ingrToShopList data: ' + data);
    });
  }
}

After bundling and starting the server, the app is not loaded and here is what shows up in console
ERROR TypeError: Eev.Eev is not a constructor

I tryed also with this code

import { Eev } from 'eev';

export class RecipeService {
  // create an Eev instance
  e = new Eev();

  functionToEmitEvent(ingredients: Ingredient[]) {
    // same as before
  }
}

Better publicise eev's performance against other libraries and in browsers other than Chrome

As few use jQuery anymore, I created a new test case comparing eev to using Vue as an eventBus. In it, you'll notice that it's considerably faster. I also tried it in Firefox, Safari and Edge (incorrectly reported as Chrome 51.0.2704), and eev's performance in these browsers is orders of magnitudes greater than against both Vue and jQuery.

Then, I decided to compare eev to the much more popular, Mitt and the results were, surprisingly to me, very similar to the massive performance improvements to the other libraries.

I really think you should publicise this.

Support wildcard event name (e.g. '*', or empty string '')?

Hi, is it possible with the current implementation to subscribe to all events with a single 'on()' call?
An example use case would be to have a (user-land) debugger that can listen to all events (without explicitly subscribing to all of them).

Thanks

Minified version not working

I don't know if is only me, but the minified version doesn't work. It spills the

Uncaught SyntaxError: Unexpected token )

error just by loading it, in both, Firefox Developer Edition 47 and Chrome 50, at least.
I had to minify this with ShrinkSafe to get a acceptable size and a working script.

Seems like UglifyJS breaks this particular (because generally it's my chosen one too) code with their «optimizations». And same happens with other alternatives, like Google Closure minifier.

TypeScript: Make eev.js interoperable with RxJS

It would be great if Eev would support easy interoperability with RxJS fromEvent https://rxjs-dev.firebaseapp.com/api/index/function/fromEvent

Currently, the only difficulty seems to be a minor type mismatch in the on / off function signatures, which do not quite match JQueryStyleEventEmitter.

changing

        on(names: string, fn: CallbackFunction): void;
        off(names: string, fn: CallbackFunction): void;

to

        on(names: string, fn: Function): void;
        off(names: string, fn: Function): void;

in eev.d.ts would fix this and allow easy conversion of events to Observables through fromEvent.

eev.d.ts is not picked up by TS compiler

Hi!

My TS compilation breaks and asks me to install @types/eev. However, there is no such thing like that, because the ambient module declaration is right in the package. However, that is not picked up. That said there is a very simple fix:
https://stackoverflow.com/questions/46650399/how-do-i-reference-a-type-declared-in-a-typescript-d-ts-file-generated-by-tscs?rq=1
You just need to reference eev.d.ts file in package.json:

{
  "main": "eev.js",
  "types": "eev.d.ts",
   "[...]": "[...]"
}

How to import this with angular 4 app

Hi,

I am trying to make two Angular apps and i want an event emitter to listen events commonly in between two different application just like micro frontend but i am unable to import this in angular 4 . Can please give some instruction to integrate this.

eev.min.js:1 Uncaught TypeError: Cannot read property 'define' of undefined

Hi,
I am trying to use Eev in the browser (using native JS).On importing the library, I am getting type error at line 65
!function(t, e) { var n = t.define; <- here n && n.amd ? n([], e) : "undefined" != typeof module && module.exports && (module.exports = e()) }(this, function() { return Eev });

Example on readme doesn't actually work

Input:

var e = new Eev()
function myHandler (data) { console.log(data); }

e.on('some-event', myHandler);
e.emit('some-event', { foo: 'Bar' });

Expected:
{ foo: 'Bar' } is passed to myHander

Actual:
Nothing happens.

Notes:
If some-event is changed to some_event or someevent, then it works. If this is intentional, it should probably be documented somewhere.

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.