From 2d05ecc22c5d45592558ea85be550191da3e98b9 Mon Sep 17 00:00:00 2001 From: Mike Ryan Date: Fri, 17 Jun 2016 17:25:51 -0500 Subject: [PATCH] fix(ZoneOperators): Remove hard dependency on Angular 2 --- lib/operator/enterZone.ts | 9 ++++----- lib/operator/leaveZone.ts | 9 ++++----- package.json | 3 +-- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/lib/operator/enterZone.ts b/lib/operator/enterZone.ts index b1e3b1c..350ece5 100644 --- a/lib/operator/enterZone.ts +++ b/lib/operator/enterZone.ts @@ -1,18 +1,17 @@ -import { NgZone } from '@angular/core'; import { Operator } from 'rxjs/Operator'; import { Subscriber } from 'rxjs/Subscriber'; import { Observable } from 'rxjs/Observable'; export interface EnterZoneSignature { - (zone: NgZone): Observable; + (zone: { run: (fn: any) => any }): Observable; } -export function enterZone(zone: NgZone): Observable { +export function enterZone(zone: { run: (fn: any) => any }): Observable { return this.lift(new EnterZoneOperator(zone)); } export class EnterZoneOperator implements Operator { - constructor(private _zone: NgZone) { } + constructor(private _zone: { run: (fn: any) => any }) { } call(subscriber: Subscriber, source: any): any { return source._subscribe(new EnterZoneSubscriber(subscriber, this._zone)); @@ -20,7 +19,7 @@ export class EnterZoneOperator implements Operator { } class EnterZoneSubscriber extends Subscriber { - constructor(destination: Subscriber, private _zone: NgZone) { + constructor(destination: Subscriber, private _zone: { run: (fn: any) => any }) { super(destination); } diff --git a/lib/operator/leaveZone.ts b/lib/operator/leaveZone.ts index 5ea9023..1f34ce5 100644 --- a/lib/operator/leaveZone.ts +++ b/lib/operator/leaveZone.ts @@ -1,18 +1,17 @@ -import { NgZone } from '@angular/core'; import { Operator } from 'rxjs/Operator'; import { Subscriber } from 'rxjs/Subscriber'; import { Observable } from 'rxjs/Observable'; -export function leaveZone(zone: NgZone): Observable { +export function leaveZone(zone: { runOutsideAngular: (fn: any) => any }): Observable { return this.lift(new LeaveZoneOperator(zone)); } export interface LeaveZoneSignature { - (zone: NgZone): Observable; + (zone: { runOutsideAngular: (fn: any) => any }): Observable; } export class LeaveZoneOperator implements Operator { - constructor(private _zone: NgZone) { } + constructor(private _zone: { runOutsideAngular: (fn: any) => any }) { } call(subscriber: Subscriber, source: any): any { return source._subscribe(new LeaveZoneSubscriber(subscriber, this._zone)); @@ -20,7 +19,7 @@ export class LeaveZoneOperator implements Operator { } class LeaveZoneSubscriber extends Subscriber { - constructor(destination: Subscriber, private _zone: NgZone) { + constructor(destination: Subscriber, private _zone: { runOutsideAngular: (fn: any) => any }) { super(destination); } diff --git a/package.json b/package.json index 6c88ba9..a3e82de 100644 --- a/package.json +++ b/package.json @@ -37,8 +37,7 @@ ], "license": "MIT", "peerDependencies": { - "rxjs": "5.0.0-beta.6", - "@angular/core": "^2.0.0-rc.1" + "rxjs": "5.0.0-beta.6" }, "devDependencies": { "@angular/common": "^2.0.0-rc.1",