LoginSignup
0
0

More than 5 years have passed since last update.

TypeScriptでEventEmitter2を使う

Posted at
/// <reference path="../typings/eventemitter2/eventemitter2.d.ts"/>

class Hoge extends EventEmitter2{
  constructor() {
    super();
    EventEmitter2.call(this);
  }
}

var hoge = new Hoge();
hoge.on("hoge", function(ev: string){
  console.log(ev);
});

hoge.emit("hoge", "hello");
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0