Comparing version 1.3.2 to 1.3.4
@@ -7,3 +7,3 @@ /** Manually handling circular import so React Native does not gives warning. */ | ||
Observable: typeof import("./Observable").Observable; | ||
ObservableCopy: typeof import("./Observable").ObservableCopy; | ||
ObservableInDepth: typeof import("./Observable").ObservableInDepth; | ||
}; |
@@ -5,5 +5,5 @@ import { EvtLike, Evt, VoidEvt } from "./Evt"; | ||
export * from "./types"; | ||
export { IObservable, Observable, ObservableCopy } from "./Observable"; | ||
export { IObservable, Observable, ObservableInDepth } from "./Observable"; | ||
export * from "./util"; | ||
import * as inDepth from "../tools/inDepth"; | ||
export { inDepth }; |
@@ -15,3 +15,3 @@ "use strict"; | ||
exports.Observable = Observable_1.Observable; | ||
exports.ObservableCopy = Observable_1.ObservableCopy; | ||
exports.ObservableInDepth = Observable_1.ObservableInDepth; | ||
__export(require("./util")); | ||
@@ -18,0 +18,0 @@ var inDepth = require("../tools/inDepth"); |
import { Evt } from "./Evt"; | ||
import { NonPostable } from "./types/helper/NonPostable"; | ||
import { from, copy } from "./util/observableFrom"; | ||
import * as staticFrom from "./util/observableFrom"; | ||
import "../tools/polyfill/Object.is"; | ||
@@ -29,3 +29,3 @@ /** | ||
/*** https://docs.evt.land/api/observable#observable-from */ | ||
static readonly from: typeof from; | ||
static readonly from: typeof staticFrom.from; | ||
private readonly evtChangeDiff_post; | ||
@@ -41,6 +41,6 @@ readonly evtDiff: IObservable<T>["evtDiff"]; | ||
} | ||
export declare class ObservableCopy<T> extends Observable<T> { | ||
export declare class ObservableInDepth<T> extends Observable<T> { | ||
/*** https://docs.evt.land/api/observable#observable-from */ | ||
static readonly from: typeof copy.from; | ||
constructor(val: T); | ||
static readonly from: typeof staticFrom.inDepth.from; | ||
constructor(val: T, same?: (val1: T, val2: T) => boolean); | ||
} |
@@ -35,3 +35,3 @@ "use strict"; | ||
var importProxy_1 = require("./importProxy"); | ||
var observableFrom_1 = require("./util/observableFrom"); | ||
var staticFrom = require("./util/observableFrom"); | ||
require("../tools/polyfill/Object.is"); | ||
@@ -86,3 +86,3 @@ var inDepth = require("../tools/inDepth"); | ||
/*** https://docs.evt.land/api/observable#observable-from */ | ||
Observable.from = observableFrom_1.from; | ||
Observable.from = staticFrom.from; | ||
return Observable; | ||
@@ -92,13 +92,13 @@ }()); | ||
importProxy_1.importProxy.Observable = Observable; | ||
var ObservableCopy = /** @class */ (function (_super) { | ||
__extends(ObservableCopy, _super); | ||
function ObservableCopy(val) { | ||
return _super.call(this, val, inDepth.same, inDepth.copy) || this; | ||
var ObservableInDepth = /** @class */ (function (_super) { | ||
__extends(ObservableInDepth, _super); | ||
function ObservableInDepth(val, same) { | ||
return _super.call(this, val, same !== null && same !== void 0 ? same : inDepth.same, inDepth.copy) || this; | ||
} | ||
/*** https://docs.evt.land/api/observable#observable-from */ | ||
ObservableCopy.from = observableFrom_1.copy.from; | ||
return ObservableCopy; | ||
ObservableInDepth.from = staticFrom.inDepth.from; | ||
return ObservableInDepth; | ||
}(Observable)); | ||
exports.ObservableCopy = ObservableCopy; | ||
importProxy_1.importProxy.ObservableCopy = ObservableCopy; | ||
exports.ObservableInDepth = ObservableInDepth; | ||
importProxy_1.importProxy.ObservableInDepth = ObservableInDepth; | ||
//# sourceMappingURL=Observable.js.map |
@@ -16,9 +16,9 @@ declare type EvtLike<T> = { | ||
export declare function from<T>(evt: EvtLike<T>, initialValue: T, same?: (val1: T, val2: T) => boolean, copy?: (val: T) => T): Observable<T>; | ||
export declare namespace copy { | ||
type ObservableCopy<T> = import("../Observable").ObservableCopy<T>; | ||
export function from<T, U>(ctx: CtxLike<any>, obs: ObservableLike<T>, transform: (val: T) => U): ObservableCopy<U>; | ||
export function from<T, U>(obs: ObservableLike<T>, transform: (val: T) => U): ObservableCopy<U>; | ||
export function from<T>(evt: EvtLike<T>, initialValue: T): ObservableCopy<T>; | ||
export declare namespace inDepth { | ||
type ObservableInDepth<T> = import("../Observable").ObservableInDepth<T>; | ||
export function from<T, U>(ctx: CtxLike<any>, obs: ObservableLike<T>, transform: (val: T) => U, same?: (val1: T, val2: T) => boolean): ObservableInDepth<U>; | ||
export function from<T, U>(obs: ObservableLike<T>, transform: (val: T) => U, same?: (val1: U, val2: U) => boolean): ObservableInDepth<U>; | ||
export function from<T>(evt: EvtLike<T>, initialValue: T, same?: (val1: T, val2: T) => boolean): ObservableInDepth<T>; | ||
export {}; | ||
} | ||
export {}; |
@@ -53,5 +53,5 @@ "use strict"; | ||
exports.from = from; | ||
var copy; | ||
(function (copy) { | ||
function from(p1, p2, p3) { | ||
var inDepth; | ||
(function (inDepth) { | ||
function from(p1, p2, p3, p4) { | ||
if ("abort" in p1) { | ||
@@ -61,3 +61,4 @@ //1 | ||
assert_1.assert(typeGuard_1.typeGuard(p3)); | ||
return fromObsImpl(function (val) { return new importProxy_1.importProxy.ObservableCopy(val); }, p1, p2, p3); | ||
assert_1.assert(typeGuard_1.typeGuard(p4)); | ||
return fromObsImpl(function (val) { return new importProxy_1.importProxy.ObservableInDepth(val, p4); }, p1, p2, p3); | ||
} | ||
@@ -69,3 +70,4 @@ else { | ||
assert_1.assert(typeGuard_1.typeGuard(p2)); | ||
return fromEvtImpl(function (val) { return new importProxy_1.importProxy.ObservableCopy(val); }, p1, p2); | ||
assert_1.assert(typeGuard_1.typeGuard(p3)); | ||
return fromEvtImpl(function (val) { return new importProxy_1.importProxy.ObservableInDepth(val, p3); }, p1, p2); | ||
} | ||
@@ -75,8 +77,9 @@ else { | ||
assert_1.assert(typeGuard_1.typeGuard(p2)); | ||
return fromObsImpl(function (val) { return new importProxy_1.importProxy.ObservableCopy(val); }, undefined, p1, p2); | ||
assert_1.assert(typeGuard_1.typeGuard(p3)); | ||
return fromObsImpl(function (val) { return new importProxy_1.importProxy.ObservableInDepth(val, p3); }, undefined, p1, p2); | ||
} | ||
} | ||
} | ||
copy.from = from; | ||
})(copy = exports.copy || (exports.copy = {})); | ||
inDepth.from = from; | ||
})(inDepth = exports.inDepth || (exports.inDepth = {})); | ||
//# sourceMappingURL=observableFrom.js.map |
{ | ||
"name": "evt", | ||
"version": "1.3.2", | ||
"version": "1.3.4", | ||
"description": "Type safe replacement for node's EventEmitter", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -8,3 +8,3 @@ | ||
Observable: typeof import("./Observable").Observable; | ||
ObservableCopy: typeof import("./Observable").ObservableCopy; | ||
ObservableInDepth: typeof import("./Observable").ObservableInDepth; | ||
} = {} as any; |
@@ -8,3 +8,3 @@ | ||
export { IObservable, Observable, ObservableCopy } from "./Observable"; | ||
export { IObservable, Observable, ObservableInDepth } from "./Observable"; | ||
export * from "./util"; | ||
@@ -11,0 +11,0 @@ |
@@ -6,3 +6,3 @@ | ||
import { importProxy } from "./importProxy"; | ||
import { from, copy } from "./util/observableFrom"; | ||
import * as staticFrom from "./util/observableFrom"; | ||
import "../tools/polyfill/Object.is"; | ||
@@ -37,3 +37,3 @@ import * as inDepth from "../tools/inDepth"; | ||
/*** https://docs.evt.land/api/observable#observable-from */ | ||
public static readonly from = from; | ||
public static readonly from = staticFrom.from; | ||
@@ -125,9 +125,12 @@ private readonly evtChangeDiff_post: (data: IObservable.Diff<T>) => void; | ||
export class ObservableCopy<T> extends Observable<T> { | ||
export class ObservableInDepth<T> extends Observable<T> { | ||
/*** https://docs.evt.land/api/observable#observable-from */ | ||
public static readonly from = copy.from; | ||
public static readonly from = staticFrom.inDepth.from; | ||
constructor(val: T) { | ||
super(val, inDepth.same, inDepth.copy); | ||
constructor( | ||
val: T, | ||
same?: (val1: T, val2: T) => boolean | ||
) { | ||
super(val, same ?? inDepth.same, inDepth.copy); | ||
} | ||
@@ -137,4 +140,2 @@ | ||
importProxy.ObservableCopy = ObservableCopy; | ||
importProxy.ObservableInDepth = ObservableInDepth; |
@@ -141,5 +141,5 @@ | ||
export namespace copy { | ||
export namespace inDepth { | ||
type ObservableCopy<T> = import("../Observable").ObservableCopy<T>; | ||
type ObservableInDepth<T> = import("../Observable").ObservableInDepth<T>; | ||
@@ -149,12 +149,15 @@ export function from<T, U>( | ||
obs: ObservableLike<T>, | ||
transform: (val: T) => U | ||
): ObservableCopy<U>; | ||
transform: (val: T) => U, | ||
same?: (val1: T, val2: T) => boolean, | ||
): ObservableInDepth<U>; | ||
export function from<T, U>( | ||
obs: ObservableLike<T>, | ||
transform: (val: T) => U | ||
): ObservableCopy<U>; | ||
transform: (val: T) => U, | ||
same?: (val1: U, val2: U) => boolean | ||
): ObservableInDepth<U>; | ||
export function from<T>( | ||
evt: EvtLike<T>, | ||
initialValue: T | ||
): ObservableCopy<T>; | ||
initialValue: T, | ||
same?: (val1: T, val2: T) => boolean | ||
): ObservableInDepth<T>; | ||
@@ -164,4 +167,5 @@ export function from<T>( | ||
p2: ObservableLike<T> | ((value: T) => any) | T, | ||
p3?: (val: T) => any | ||
): ObservableCopy<any> { | ||
p3?: ((val: T) => any) | ((val1: any, val2: any) => boolean) | ((val1: T, val2: T) => boolean), | ||
p4?: (val1: T, val2: T) => boolean | ||
): ObservableInDepth<any> { | ||
@@ -173,5 +177,6 @@ if ("abort" in p1) { | ||
assert(typeGuard<(val: T) => any>(p3)) | ||
assert(typeGuard<((val1: T, val2: T) => boolean) | undefined>(p4)) | ||
return fromObsImpl( | ||
val => new importProxy.ObservableCopy(val), | ||
val => new importProxy.ObservableInDepth(val, p4), | ||
p1, p2, p3 | ||
@@ -189,5 +194,6 @@ ); | ||
assert(typeGuard<T>(p2)) | ||
assert(typeGuard<((val1: T, val2: T) => boolean) | undefined>(p3)) | ||
return fromEvtImpl( | ||
val => new importProxy.ObservableCopy(val), | ||
val => new importProxy.ObservableInDepth(val, p3), | ||
p1, p2 | ||
@@ -201,5 +207,6 @@ ); | ||
assert(typeGuard<(value: T) => any>(p2)) | ||
assert(typeGuard<((val1: any, val2: any) => boolean) | undefined>(p3)) | ||
return fromObsImpl( | ||
val => new importProxy.ObservableCopy(val), | ||
val => new importProxy.ObservableInDepth(val, p3), | ||
undefined, p1, p2 | ||
@@ -206,0 +213,0 @@ ); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
1905601
39471