Class: EventSubject<T>
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/observer/observable.ts:61
This is a custom implementation of RxJS subject. It handles events on canvas elements. In addition to the event, it also emits a state object that can be used to controls the propagation of the event.
Extends
Subject
<[T
,EventState
]>
Type Parameters
Type Parameter |
---|
T |
Constructors
new EventSubject()
new EventSubject<T>(): EventSubject<T>
Defined in: packages/api/tmp/univer-pro/node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/types/internal/Subject.d.ts:29
Returns
EventSubject
<T
>
Inherited from
Subject<[T, EventState]>.constructor
Properties
Property | Modifier | Type | Description | Inherited from | Defined in |
---|---|---|---|---|---|
closed | public | boolean | - | Subject.closed | packages/api/tmp/univer-pro/node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/types/internal/Subject.d.ts:12 |
hasError | public | boolean | Deprecated Internal implementation detail, do not use directly. Will be made internal in v8. | Subject.hasError | packages/api/tmp/univer-pro/node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/types/internal/Subject.d.ts:19 |
isStopped | public | boolean | Deprecated Internal implementation detail, do not use directly. Will be made internal in v8. | Subject.isStopped | packages/api/tmp/univer-pro/node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/types/internal/Subject.d.ts:17 |
observers | public | Observer <[T , EventState ]>[] | Deprecated Internal implementation detail, do not use directly. Will be made internal in v8. | Subject.observers | packages/api/tmp/univer-pro/node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/types/internal/Subject.d.ts:15 |
operator | public | undefined | Operator <any , [T , EventState ]> | Deprecated Internal implementation detail, do not use directly. Will be made internal in v8. | Subject.operator | packages/api/tmp/univer-pro/node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/types/internal/Observable.d.ts:19 |
source | public | undefined | Observable <any > | Deprecated Internal implementation detail, do not use directly. Will be made internal in v8. | Subject.source | packages/api/tmp/univer-pro/node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/types/internal/Observable.d.ts:15 |
thrownError | public | any | Deprecated Internal implementation detail, do not use directly. Will be made internal in v8. | Subject.thrownError | packages/api/tmp/univer-pro/node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/types/internal/Subject.d.ts:21 |
create | static | (…args : any []) => any | Creates a “subject” by basically gluing an observer to an observable. Nocollapse Deprecated Recommended you do not use. Will be removed at some point in the future. Plans for replacement still under discussion. | Subject.create | packages/api/tmp/univer-pro/node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/types/internal/Subject.d.ts:28 |
Accessors
observed
Get Signature
get observed(): boolean
Defined in: packages/api/tmp/univer-pro/node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/types/internal/Subject.d.ts:36
Returns
boolean
Inherited from
Subject.observed
Methods
asObservable()
asObservable(): Observable<[T, EventState]>
Defined in: packages/api/tmp/univer-pro/node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/types/internal/Subject.d.ts:43
Creates a new Observable with this Subject as the source. You can do this to create custom Observer-side logic of the Subject and conceal it from code that uses the Observable.
Returns
Observable
<[T
, EventState
]>
Observable that the Subject casts to
Inherited from
Subject.asObservable
clearObservers()
clearObservers(): void
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/observer/observable.ts:100
Returns
void
complete()
complete(): void
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/observer/observable.ts:79
Returns
void
Overrides
Subject.complete
emitEvent()
emitEvent(event): INotifyObserversReturn
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/observer/observable.ts:105
Parameters
Parameter | Type |
---|---|
event | T |
Returns
INotifyObserversReturn
error()
error(err): void
Defined in: packages/api/tmp/univer-pro/node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/types/internal/Subject.d.ts:33
Parameters
Parameter | Type |
---|---|
err | any |
Returns
void
Inherited from
Subject.error
forEach()
Call Signature
forEach(next): Promise<void>
Defined in: packages/api/tmp/univer-pro/node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/types/internal/Observable.d.ts:97
Used as a NON-CANCELLABLE means of subscribing to an observable, for use with
APIs that expect promises, like async/await
. You cannot unsubscribe from this.
WARNING: Only use this with observables you know will complete. If the source observable does not complete, you will end up with a promise that is hung up, and potentially all of the state of an async function hanging out in memory. To avoid this situation, look into adding something like timeout, take, takeWhile, or takeUntil amongst others.
Example
import { interval, take } from 'rxjs';
const source$ = interval(1000).pipe(take(4));
async function getTotal() {
let total = 0;
await source$.forEach(value => {
total += value;
console.log('observable -> ' + value);
});
return total;
}
getTotal().then(
total => console.log('Total: ' + total)
);
// Expected:
// 'observable -> 0'
// 'observable -> 1'
// 'observable -> 2'
// 'observable -> 3'
// 'Total: 6'
Parameters
Parameter | Type | Description |
---|---|---|
next | (value ) => void | a handler for each value emitted by the observable |
Returns
Promise
<void
>
a promise that either resolves on observable completion or rejects with the handled error
Inherited from
Subject.forEach
Call Signature
forEach(next, promiseCtor): Promise<void>
Defined in: packages/api/tmp/univer-pro/node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/types/internal/Observable.d.ts:109
Parameters
Parameter | Type | Description |
---|---|---|
next | (value ) => void | a handler for each value emitted by the observable |
promiseCtor | PromiseConstructorLike | a constructor function used to instantiate the Promise |
Returns
Promise
<void
>
a promise that either resolves on observable completion or rejects with the handled error
Deprecated
Passing a Promise constructor will no longer be available in upcoming versions of RxJS. This is because it adds weight to the library, for very little benefit. If you need this functionality, it is recommended that you either polyfill Promise, or you create an adapter to convert the returned native promise to whatever promise implementation you wanted. Will be removed in v8.
Inherited from
Subject.forEach
lift()
lift<R>(operator): Observable<R>
Defined in: packages/api/tmp/univer-pro/node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/types/internal/Subject.d.ts:31
Type Parameters
Type Parameter |
---|
R |
Parameters
Parameter | Type |
---|---|
operator | Operator <[T , EventState ], R > |
Returns
Observable
<R
>
Deprecated
Internal implementation detail, do not use directly. Will be made internal in v8.
Inherited from
Subject.lift
next()
next(): void
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/observer/observable.ts:70
Returns
void
Deprecated
Use emitEvent
instead.
Overrides
Subject.next
pipe()
Call Signature
pipe(): Observable<[T, EventState]>
Defined in: packages/api/tmp/univer-pro/node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/types/internal/Observable.d.ts:110
Returns
Observable
<[T
, EventState
]>
Inherited from
Subject.pipe
Call Signature
pipe<A>(op1): Observable<A>
Defined in: packages/api/tmp/univer-pro/node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/types/internal/Observable.d.ts:111
Type Parameters
Type Parameter |
---|
A |
Parameters
Parameter | Type |
---|---|
op1 | OperatorFunction <[T , EventState ], A > |
Returns
Observable
<A
>
Inherited from
Subject.pipe
Call Signature
pipe<A, B>(op1, op2): Observable<B>
Defined in: packages/api/tmp/univer-pro/node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/types/internal/Observable.d.ts:112
Type Parameters
Type Parameter |
---|
A |
B |
Parameters
Parameter | Type |
---|---|
op1 | OperatorFunction <[T , EventState ], A > |
op2 | OperatorFunction <A , B > |
Returns
Observable
<B
>
Inherited from
Subject.pipe
Call Signature
pipe<A, B, C>(
op1,
op2,
op3): Observable<C>
Defined in: packages/api/tmp/univer-pro/node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/types/internal/Observable.d.ts:113
Type Parameters
Type Parameter |
---|
A |
B |
C |
Parameters
Parameter | Type |
---|---|
op1 | OperatorFunction <[T , EventState ], A > |
op2 | OperatorFunction <A , B > |
op3 | OperatorFunction <B , C > |
Returns
Observable
<C
>
Inherited from
Subject.pipe
Call Signature
pipe<A, B, C, D>(
op1,
op2,
op3,
op4): Observable<D>
Defined in: packages/api/tmp/univer-pro/node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/types/internal/Observable.d.ts:114
Type Parameters
Type Parameter |
---|
A |
B |
C |
D |
Parameters
Parameter | Type |
---|---|
op1 | OperatorFunction <[T , EventState ], A > |
op2 | OperatorFunction <A , B > |
op3 | OperatorFunction <B , C > |
op4 | OperatorFunction <C , D > |
Returns
Observable
<D
>
Inherited from
Subject.pipe
Call Signature
pipe<A, B, C, D, E>(
op1,
op2,
op3,
op4,
op5): Observable<E>
Defined in: packages/api/tmp/univer-pro/node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/types/internal/Observable.d.ts:115
Type Parameters
Type Parameter |
---|
A |
B |
C |
D |
E |
Parameters
Parameter | Type |
---|---|
op1 | OperatorFunction <[T , EventState ], A > |
op2 | OperatorFunction <A , B > |
op3 | OperatorFunction <B , C > |
op4 | OperatorFunction <C , D > |
op5 | OperatorFunction <D , E > |
Returns
Observable
<E
>
Inherited from
Subject.pipe
Call Signature
pipe<A, B, C, D, E, F>(
op1,
op2,
op3,
op4,
op5,
op6): Observable<F>
Defined in: packages/api/tmp/univer-pro/node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/types/internal/Observable.d.ts:116
Type Parameters
Type Parameter |
---|
A |
B |
C |
D |
E |
F |
Parameters
Parameter | Type |
---|---|
op1 | OperatorFunction <[T , EventState ], A > |
op2 | OperatorFunction <A , B > |
op3 | OperatorFunction <B , C > |
op4 | OperatorFunction <C , D > |
op5 | OperatorFunction <D , E > |
op6 | OperatorFunction <E , F > |
Returns
Observable
<F
>
Inherited from
Subject.pipe
Call Signature
pipe<A, B, C, D, E, F, G>(
op1,
op2,
op3,
op4,
op5,
op6,
op7): Observable<G>
Defined in: packages/api/tmp/univer-pro/node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/types/internal/Observable.d.ts:117
Type Parameters
Type Parameter |
---|
A |
B |
C |
D |
E |
F |
G |
Parameters
Parameter | Type |
---|---|
op1 | OperatorFunction <[T , EventState ], A > |
op2 | OperatorFunction <A , B > |
op3 | OperatorFunction <B , C > |
op4 | OperatorFunction <C , D > |
op5 | OperatorFunction <D , E > |
op6 | OperatorFunction <E , F > |
op7 | OperatorFunction <F , G > |
Returns
Observable
<G
>
Inherited from
Subject.pipe
Call Signature
pipe<A, B, C, D, E, F, G, H>(
op1,
op2,
op3,
op4,
op5,
op6,
op7,
op8): Observable<H>
Defined in: packages/api/tmp/univer-pro/node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/types/internal/Observable.d.ts:118
Type Parameters
Type Parameter |
---|
A |
B |
C |
D |
E |
F |
G |
H |
Parameters
Parameter | Type |
---|---|
op1 | OperatorFunction <[T , EventState ], A > |
op2 | OperatorFunction <A , B > |
op3 | OperatorFunction <B , C > |
op4 | OperatorFunction <C , D > |
op5 | OperatorFunction <D , E > |
op6 | OperatorFunction <E , F > |
op7 | OperatorFunction <F , G > |
op8 | OperatorFunction <G , H > |
Returns
Observable
<H
>
Inherited from
Subject.pipe
Call Signature
pipe<A, B, C, D, E, F, G, H, I>(
op1,
op2,
op3,
op4,
op5,
op6,
op7,
op8,
op9): Observable<I>
Defined in: packages/api/tmp/univer-pro/node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/types/internal/Observable.d.ts:119
Type Parameters
Type Parameter |
---|
A |
B |
C |
D |
E |
F |
G |
H |
I |
Parameters
Parameter | Type |
---|---|
op1 | OperatorFunction <[T , EventState ], A > |
op2 | OperatorFunction <A , B > |
op3 | OperatorFunction <B , C > |
op4 | OperatorFunction <C , D > |
op5 | OperatorFunction <D , E > |
op6 | OperatorFunction <E , F > |
op7 | OperatorFunction <F , G > |
op8 | OperatorFunction <G , H > |
op9 | OperatorFunction <H , I > |
Returns
Observable
<I
>
Inherited from
Subject.pipe
Call Signature
pipe<A, B, C, D, E, F, G, H, I>(
op1,
op2,
op3,
op4,
op5,
op6,
op7,
op8,
op9, ...
operations): Observable<unknown>
Defined in: packages/api/tmp/univer-pro/node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/types/internal/Observable.d.ts:120
Type Parameters
Type Parameter |
---|
A |
B |
C |
D |
E |
F |
G |
H |
I |
Parameters
Parameter | Type |
---|---|
op1 | OperatorFunction <[T , EventState ], A > |
op2 | OperatorFunction <A , B > |
op3 | OperatorFunction <B , C > |
op4 | OperatorFunction <C , D > |
op5 | OperatorFunction <D , E > |
op6 | OperatorFunction <E , F > |
op7 | OperatorFunction <F , G > |
op8 | OperatorFunction <G , H > |
op9 | OperatorFunction <H , I > |
…operations | OperatorFunction <any , any >[] |
Returns
Observable
<unknown
>
Inherited from
Subject.pipe
subscribe()
subscribe(): Subscription
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/observer/observable.ts:65
Returns
Subscription
Deprecated
Use subscribeEvent
instead.
Overrides
Subject.subscribe
subscribeEvent()
subscribeEvent(observer): Subscription
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/observer/observable.ts:84
Parameters
Parameter | Type |
---|---|
observer | | IEventObserver <T > | (evt , state ) => unknown |
Returns
Subscription
toPromise()
Call Signature
toPromise(): Promise<undefined | [T, EventState]>
Defined in: packages/api/tmp/univer-pro/node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/types/internal/Observable.d.ts:122
Returns
Promise
<undefined
| [T
, EventState
]>
Deprecated
Replaced with firstValueFrom and lastValueFrom. Will be removed in v8. Details: https://rxjs.dev/deprecations/to-promise
Inherited from
Subject.toPromise
Call Signature
toPromise(PromiseCtor): Promise<undefined | [T, EventState]>
Defined in: packages/api/tmp/univer-pro/node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/types/internal/Observable.d.ts:124
Parameters
Parameter | Type |
---|---|
PromiseCtor | PromiseConstructor |
Returns
Promise
<undefined
| [T
, EventState
]>
Deprecated
Replaced with firstValueFrom and lastValueFrom. Will be removed in v8. Details: https://rxjs.dev/deprecations/to-promise
Inherited from
Subject.toPromise
Call Signature
toPromise(PromiseCtor): Promise<undefined | [T, EventState]>
Defined in: packages/api/tmp/univer-pro/node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/types/internal/Observable.d.ts:126
Parameters
Parameter | Type |
---|---|
PromiseCtor | PromiseConstructorLike |
Returns
Promise
<undefined
| [T
, EventState
]>
Deprecated
Replaced with firstValueFrom and lastValueFrom. Will be removed in v8. Details: https://rxjs.dev/deprecations/to-promise
Inherited from
Subject.toPromise
unsubscribe()
unsubscribe(): void
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/observer/observable.ts:74
Returns
void
Overrides
Subject.unsubscribe