前端代码
This commit is contained in:
22
node_modules/rx/ts/core/subjects/anonymoussubject.ts
generated
vendored
Normal file
22
node_modules/rx/ts/core/subjects/anonymoussubject.ts
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
/// <reference path="./subject.ts" />
|
||||
module Rx {
|
||||
export interface AnonymousSubject<T> extends Subject<T> { }
|
||||
|
||||
interface AnonymousSubjectStatic {
|
||||
/**
|
||||
* Creates a subject that can only receive one value and that value is cached for all future observations.
|
||||
* @constructor
|
||||
*/
|
||||
new <T>(): AnonymousSubject<T>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents the result of an asynchronous operation.
|
||||
* The last value before the OnCompleted notification, or the error received through OnError, is sent to all subscribed observers.
|
||||
*/
|
||||
export var AnonymousSubject: AnonymousSubjectStatic;
|
||||
}
|
||||
|
||||
(function() {
|
||||
var s : Rx.AnonymousSubject<boolean> = new Rx.AnonymousSubject<boolean>();
|
||||
});
|
23
node_modules/rx/ts/core/subjects/asyncsubject.ts
generated
vendored
Normal file
23
node_modules/rx/ts/core/subjects/asyncsubject.ts
generated
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
/// <reference path="./subject.ts" />
|
||||
|
||||
module Rx {
|
||||
export interface AsyncSubject<T> extends Subject<T> { }
|
||||
|
||||
interface AsyncSubjectStatic {
|
||||
/**
|
||||
* Creates a subject that can only receive one value and that value is cached for all future observations.
|
||||
* @constructor
|
||||
*/
|
||||
new <T>(): AsyncSubject<T>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents the result of an asynchronous operation.
|
||||
* The last value before the OnCompleted notification, or the error received through OnError, is sent to all subscribed observers.
|
||||
*/
|
||||
export var AsyncSubject: AsyncSubjectStatic;
|
||||
}
|
||||
|
||||
(function() {
|
||||
var s : Rx.AsyncSubject<boolean> = new Rx.AsyncSubject<boolean>();
|
||||
});
|
33
node_modules/rx/ts/core/subjects/behaviorsubject.ts
generated
vendored
Normal file
33
node_modules/rx/ts/core/subjects/behaviorsubject.ts
generated
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
/// <reference path="./subject.ts" />
|
||||
|
||||
module Rx {
|
||||
export interface BehaviorSubject<T> extends Subject<T> {
|
||||
/**
|
||||
* Gets the current value or throws an exception.
|
||||
* Value is frozen after onCompleted is called.
|
||||
* After onError is called always throws the specified exception.
|
||||
* An exception is always thrown after dispose is called.
|
||||
* @returns {Mixed} The initial value passed to the constructor until onNext is called; after which, the last value passed to onNext.
|
||||
*/
|
||||
getValue(): T;
|
||||
}
|
||||
|
||||
interface BehaviorSubjectStatic {
|
||||
/**
|
||||
* Initializes a new instance of the BehaviorSubject class which creates a subject that caches its last value and starts with the specified value.
|
||||
* @param {Mixed} value Initial value sent to observers when no other value has been received by the subject yet.
|
||||
*/
|
||||
new <T>(initialValue: T): BehaviorSubject<T>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a value that changes over time.
|
||||
* Observers can subscribe to the subject to receive the last (or initial) value and all subsequent notifications.
|
||||
*/
|
||||
export var BehaviorSubject: BehaviorSubjectStatic;
|
||||
}
|
||||
|
||||
(function() {
|
||||
var s : Rx.BehaviorSubject<boolean> = new Rx.BehaviorSubject(false);
|
||||
var b : boolean = s.getValue();
|
||||
});
|
28
node_modules/rx/ts/core/subjects/replaysubject.ts
generated
vendored
Normal file
28
node_modules/rx/ts/core/subjects/replaysubject.ts
generated
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
/// <reference path="./subject.ts" />
|
||||
/// <reference path="../concurrency/scheduler.ts" />
|
||||
module Rx {
|
||||
export interface ReplaySubject<T> extends Subject<T> { }
|
||||
|
||||
interface ReplaySubjectStatic {
|
||||
/**
|
||||
* Initializes a new instance of the ReplaySubject class with the specified buffer size, window size and scheduler.
|
||||
* @param {Number} [bufferSize] Maximum element count of the replay buffer.
|
||||
* @param {Number} [windowSize] Maximum time length of the replay buffer.
|
||||
* @param {Scheduler} [scheduler] Scheduler the observers are invoked on.
|
||||
*/
|
||||
new <T>(bufferSize?: number, window?: number, scheduler?: IScheduler): ReplaySubject<T>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents an object that is both an observable sequence as well as an observer.
|
||||
* Each notification is broadcasted to all subscribed and future observers, subject to buffer trimming policies.
|
||||
*/
|
||||
export var ReplaySubject: ReplaySubjectStatic;
|
||||
}
|
||||
|
||||
(function() {
|
||||
var s : Rx.ReplaySubject<boolean> = new Rx.ReplaySubject<boolean>();
|
||||
var s : Rx.ReplaySubject<boolean> = new Rx.ReplaySubject<boolean>(10);
|
||||
var s : Rx.ReplaySubject<boolean> = new Rx.ReplaySubject<boolean>(10, 10);
|
||||
var s : Rx.ReplaySubject<boolean> = new Rx.ReplaySubject<boolean>(10, 10, Rx.Scheduler.async);
|
||||
});
|
59
node_modules/rx/ts/core/subjects/subject.ts
generated
vendored
Normal file
59
node_modules/rx/ts/core/subjects/subject.ts
generated
vendored
Normal file
@ -0,0 +1,59 @@
|
||||
/// <reference path="../observable.ts" />
|
||||
/// <reference path="../observer-lite.ts" />
|
||||
/// <reference path="../disposables/disposable.ts"/>
|
||||
|
||||
module Rx {
|
||||
/**
|
||||
* Represents an object that is both an observable sequence as well as an observer.
|
||||
* Each notification is broadcasted to all subscribed observers.
|
||||
*/
|
||||
export interface ISubject<T> extends IObservable<T>, IObserver<T>, IDisposable {
|
||||
hasObservers(): boolean;
|
||||
}
|
||||
|
||||
export interface Subject<T> extends Observable<T>, Observer<T>, IDisposable {
|
||||
hasObservers(): boolean;
|
||||
/** Is this value disposed. */
|
||||
isDisposed: boolean;
|
||||
}
|
||||
|
||||
interface SubjectStatic {
|
||||
/**
|
||||
* Creates a subject.
|
||||
*/
|
||||
new <T>(): Subject<T>;
|
||||
|
||||
/**
|
||||
* Creates a subject from the specified observer and observable.
|
||||
* @param {Observer} observer The observer used to send messages to the subject.
|
||||
* @param {Observable} observable The observable used to subscribe to messages sent from the subject.
|
||||
* @returns {Subject} Subject implemented using the given observer and observable.
|
||||
*/
|
||||
create<T>(observer?: IObserver<T>, observable?: IObservable<T>): Subject<T>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents an object that is both an observable sequence as well as an observer.
|
||||
* Each notification is broadcasted to all subscribed observers.
|
||||
*/
|
||||
export var Subject: SubjectStatic;
|
||||
}
|
||||
|
||||
(function() {
|
||||
var is: Rx.ISubject<boolean> = new Rx.Subject<boolean>();
|
||||
var s : Rx.Subject<boolean> = new Rx.Subject<boolean>();
|
||||
|
||||
is.hasObservers();
|
||||
s.hasObservers();
|
||||
|
||||
s.isDisposed;
|
||||
|
||||
var iob : Rx.IObserver<boolean> = s;
|
||||
var io : Rx.IObservable<boolean> = s;
|
||||
var ob : Rx.Observer<boolean> = s;
|
||||
var o : Rx.Observable<boolean> = s;
|
||||
var d : Rx.IDisposable = s;
|
||||
|
||||
var ns : Rx.ISubject<boolean> = Rx.Subject.create(iob, io);
|
||||
var ns : Rx.ISubject<boolean> = Rx.Subject.create(ob, o);
|
||||
});
|
Reference in New Issue
Block a user