Skip to content

Commit b27a709

Browse files
committed
Alias Observable[Symbol.observable] to Observable.toESObservable
1 parent 8bbbdab commit b27a709

File tree

5 files changed

+12
-12
lines changed

5 files changed

+12
-12
lines changed

dist/Bacon.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -3417,10 +3417,12 @@ ESObservable.prototype[symbol('observable')] = function () {
34173417
return this;
34183418
};
34193419

3420-
Bacon.Observable.prototype[symbol('observable')] = function () {
3420+
Bacon.Observable.prototype.toESObservable = function () {
34213421
return new ESObservable(this);
34223422
};
34233423

3424+
Bacon.Observable.prototype[symbol('observable')] = Bacon.Observable.prototype.toESObservable;
3425+
34243426
Bacon.fromESObservable = function (_observable) {
34253427
var observable;
34263428
if (_observable[symbol("observable")]) {

dist/Bacon.min.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/Bacon.noAssert.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -3203,9 +3203,10 @@
32033203
ESObservable.prototype[symbol('observable')] = function () {
32043204
return this;
32053205
};
3206-
Bacon.Observable.prototype[symbol('observable')] = function () {
3206+
Bacon.Observable.prototype.toESObservable = function () {
32073207
return new ESObservable(this);
32083208
};
3209+
Bacon.Observable.prototype[symbol('observable')] = Bacon.Observable.prototype.toESObservable;
32093210
Bacon.fromESObservable = function (_observable) {
32103211
var observable;
32113212
if (_observable[symbol('observable')]) {

spec/specs/esobservable.coffee

+2-7
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
# build-dependencies: bus
22
Observable = require 'zen-observable'
33

4-
symbolObservable = if typeof Symbol != 'undefined'
5-
Symbol.for('observable')
6-
else
7-
'@@observable'
8-
94
describe "EventStream[Symbol.observable]", ->
105
it "outputs compatible Observable", (done) ->
116
bus = new Bacon.Bus
@@ -49,7 +44,7 @@ describe "EventStream[Symbol.observable]", ->
4944
it "unsubscribes stream after an error", (done) ->
5045
bus = new Bacon.Bus
5146
values = []
52-
observable = bus[symbolObservable]()
47+
observable = bus.toESObservable()
5348
observable.subscribe
5449
next: (x) -> values.push(x)
5550

@@ -68,7 +63,7 @@ describe "EventStream[Symbol.observable]", ->
6863
onValue = (x) -> values.push(x)
6964
onError = (x) -> errors.push(x)
7065
onComplete = (x) -> completes.push(x)
71-
observable = bus[symbolObservable]()
66+
observable = bus.toESObservable()
7267
observable.subscribe(onValue, onError, onComplete)
7368
bus.push(1)
7469
bus.error(2)

src/esobservable.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ ESObservable.prototype[symbol('observable')] = function() {
3434
return this;
3535
};
3636

37-
Bacon.Observable.prototype[symbol('observable')] = function() {
37+
Bacon.Observable.prototype.toESObservable = function() {
3838
return new ESObservable(this);
3939
};
40+
41+
Bacon.Observable.prototype[symbol('observable')] = Bacon.Observable.prototype.toESObservable;

0 commit comments

Comments
 (0)