refactor(async): refactor EventEmitter

Refactor EventEmitter and Async Facade to match ES7 Observable semantics, properly use RxJS typedefs, make EventEmitter inherit from RxJS Subject. Closes #4149.

BREAKING CHANGE:
- consumers of EventEmitter no longer need to call .toRx()
- EventEmitter is now generic and requires a type - e.g. `EventEmitter<string>`
- EventEmitter and Observable now use the `.subscribe(generatorOrNext, error, complete)` method instead of `.observer(generator)`
- ObservableWrapper uses `callNext/callError/callComplete` instead of `callNext/callThrow/callReturn`
This commit is contained in:
Rob Wormald
2015-10-24 18:48:43 -07:00
parent 72e65d6797
commit ca3986f31d
35 changed files with 341 additions and 113 deletions
@@ -907,7 +907,7 @@ class WrappedValue implements ControlValueAccessor {
@Component({selector: "my-input", template: ''})
class MyInput implements ControlValueAccessor {
@Output('change') onChange: EventEmitter = new EventEmitter();
@Output('change') onChange: EventEmitter<any> = new EventEmitter();
value: string;
constructor(cd: NgControl) { cd.valueAccessor = this; }
@@ -133,7 +133,7 @@ export function main() {
if (!IS_DART) {
it("should update set errors and status before emitting an event",
inject([AsyncTestCompleter], (async) => {
c.valueChanges.toRx().subscribe(value => {
c.valueChanges.subscribe(value => {
expect(c.valid).toEqual(false);
expect(c.errors).toEqual({"required": true});
async.done();