Skip to content

Commit

Permalink
fix(rstream): avoid Subscription ctor to workaround parceljs build issue
Browse files Browse the repository at this point in the history
- use `subscription()` factory instead of `new Subscription`
- solves issue w/ parcel's scope hoisting build flag
  • Loading branch information
postspectacular committed Jan 5, 2019
1 parent e201ca8 commit d1e275b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions packages/rstream/src/pubsub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { EquivMap } from "@thi.ng/associative/equiv-map";
import { unsupported } from "@thi.ng/errors/unsupported";
import { Transducer } from "@thi.ng/transducers/api";
import { DEBUG, ISubscriber } from "./api";
import { Subscription } from "./subscription";
import { Subscription, subscription } from "./subscription";
import { nextID } from "./utils/idgen";

export interface PubSubOpts<A, B> {
Expand Down Expand Up @@ -84,7 +84,7 @@ export class PubSub<A, B> extends Subscription<A, B> {
subscribeTopic(topicID: any, sub: any, id?: string): Subscription<any, any> {
let t = this.topics.get(topicID);
if (!t) {
this.topics.set(topicID, t = new Subscription<B, B>());
this.topics.set(topicID, t = subscription<B, B>());
}
return t.subscribe(sub, id);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/rstream/src/subscription.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ export class Subscription<A, B> implements
if (implementsFunction(sub, "subscribe")) {
sub.parent = this;
} else {
sub = new Subscription(sub, xform, this, id);
sub = subscription(sub, xform, this, id);
}
if (this.last !== SEMAPHORE) {
sub.next(this.last);
Expand Down

0 comments on commit d1e275b

Please sign in to comment.