X Tutup
Skip to content

Commit 3fa287a

Browse files
committed
refactor(EventEmitter): rename .next() to .emit()
BREAKING CHANGE: EventEmitter#next(value) is deprecated, use EventEmitter#emit(value) instead. Closes angular#4287 Closes angular#5302
1 parent 929abb9 commit 3fa287a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+103
-78
lines changed

modules/angular1_router/lib/facades.es5

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,9 @@ var ObservableWrapper = {
276276
callNext: function(ob, val) {
277277
ob.fn(val);
278278
},
279+
callEmit: function(ob, val) {
280+
ob.fn(val);
281+
},
279282

280283
subscribe: function(ob, fn) {
281284
ob.fn = fn;

modules/angular2/docs/web_workers/web_workers.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ import {bootstrap} from 'angular2/web_worker/ui';
230230
var instance = bootstrap("loader.js");
231231
var bus = instance.bus;
232232
bus.initChannel("My Custom Channel");
233-
bus.to("My Custom Channel").next("hello from the UI");
233+
bus.to("My Custom Channel").emit("hello from the UI");
234234
```
235235
```TypeScript
236236
// background_index.ts, which is running on the WebWorker

modules/angular2/src/common/forms/directives/ng_control_name.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ export class NgControlName extends NgControl implements OnChanges,
117117

118118
viewToModelUpdate(newValue: any): void {
119119
this.viewModel = newValue;
120-
ObservableWrapper.callNext(this.update, newValue);
120+
ObservableWrapper.callEmit(this.update, newValue);
121121
}
122122

123123
get path(): string[] { return controlPath(this.name, this._parent); }

modules/angular2/src/common/forms/directives/ng_form.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ export class NgForm extends ControlContainer implements Form {
160160
}
161161

162162
onSubmit(): boolean {
163-
ObservableWrapper.callNext(this.ngSubmit, null);
163+
ObservableWrapper.callEmit(this.ngSubmit, null);
164164
return false;
165165
}
166166

modules/angular2/src/common/forms/directives/ng_form_control.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ export class NgFormControl extends NgControl implements OnChanges {
110110

111111
viewToModelUpdate(newValue: any): void {
112112
this.viewModel = newValue;
113-
ObservableWrapper.callNext(this.update, newValue);
113+
ObservableWrapper.callEmit(this.update, newValue);
114114
}
115115

116116
private _isControlChanged(changes: {[key: string]: any}): boolean {

modules/angular2/src/common/forms/directives/ng_form_model.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ export class NgFormModel extends ControlContainer implements Form,
157157
}
158158

159159
onSubmit(): boolean {
160-
ObservableWrapper.callNext(this.ngSubmit, null);
160+
ObservableWrapper.callEmit(this.ngSubmit, null);
161161
return false;
162162
}
163163

modules/angular2/src/common/forms/directives/ng_model.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,6 @@ export class NgModel extends NgControl implements OnChanges {
8686

8787
viewToModelUpdate(newValue: any): void {
8888
this.viewModel = newValue;
89-
ObservableWrapper.callNext(this.update, newValue);
89+
ObservableWrapper.callEmit(this.update, newValue);
9090
}
9191
}

modules/angular2/src/common/forms/model.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,8 @@ export abstract class AbstractControl {
128128
}
129129

130130
if (emitEvent) {
131-
ObservableWrapper.callNext(this._valueChanges, this._value);
132-
ObservableWrapper.callNext(this._statusChanges, this._status);
131+
ObservableWrapper.callEmit(this._valueChanges, this._value);
132+
ObservableWrapper.callEmit(this._statusChanges, this._status);
133133
}
134134

135135
if (isPresent(this._parent) && !onlySelf) {
@@ -185,7 +185,7 @@ export abstract class AbstractControl {
185185
this._status = this._calculateStatus();
186186

187187
if (emitEvent) {
188-
ObservableWrapper.callNext(this._statusChanges, this._status);
188+
ObservableWrapper.callEmit(this._statusChanges, this._status);
189189
}
190190

191191
if (isPresent(this._parent)) {

modules/angular2/src/core/linker/query_list.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,5 +66,5 @@ export class QueryList<T> {
6666
reset(res: T[]): void { this._results = res; }
6767

6868
/** @internal */
69-
notifyOnChanges(): void { this._emitter.next(this); }
69+
notifyOnChanges(): void { this._emitter.emit(this); }
7070
}

modules/angular2/src/core/metadata.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1321,8 +1321,8 @@ export var Input: InputFactory = makePropDecorator(InputMetadata);
13211321
* @Output('everyFiveSeconds') five5Secs = new EventEmitter();
13221322
*
13231323
* constructor() {
1324-
* setInterval(() => this.everySecond.next("event"), 1000);
1325-
* setInterval(() => this.five5Secs.next("event"), 5000);
1324+
* setInterval(() => this.everySecond.emit("event"), 1000);
1325+
* setInterval(() => this.five5Secs.emit("event"), 5000);
13261326
* }
13271327
* }
13281328
*

0 commit comments

Comments
 (0)
X Tutup