Difference between EventEmitter.next() and EventEmitter.emit() in Angular 2

后端 未结 2 765
借酒劲吻你
借酒劲吻你 2021-01-31 23:55

What is the difference between EventEmitter.emit() and EventEmitter.next()? Both dispatching the event to the subscribed listeners.



        
2条回答
  •  自闭症患者
    2021-02-01 00:50

    They do the same. emit() is the current version, next() is deprecated.

    See also https://github.com/angular/angular/blob/b5b6ece65a96f5b8f134ad4899b56bf84afe3ba0/modules/angular2/src/facade/async.dart#L49

提交回复
热议问题