Skip to content
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

Eev.Eev is not a constructor #15

Open
gAllegr opened this issue Mar 7, 2019 · 2 comments
Open

Eev.Eev is not a constructor #15

gAllegr opened this issue Mar 7, 2019 · 2 comments

Comments

@gAllegr
Copy link

gAllegr commented Mar 7, 2019

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
  }
}
@valepu
Copy link

valepu commented Apr 4, 2019

I was having a similar issue but i solved using import Eev from 'eev';

@shilangyu
Copy link

Its because the d.ts file says Eev is being exported as a property and as a default, whilst the code exports it as a default only. Therefore Eev should be imported as import Eev from 'eev'. I fixed this issue in #16

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants