@univerjs/core v0.4.2 • Docs
Class: EventSubject<T>
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>
Returns
EventSubject
<T
>
Inherited from
Subject<[T, EventState]>.constructor
Defined in
submodules/univer/node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/types/internal/Subject.d.ts:29
Properties
Property | Modifier | Type | Description | Inherited from | Defined in |
---|---|---|---|---|---|
closed | public | boolean | - | Subject.closed | submodules/univer/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 | submodules/univer/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 | submodules/univer/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 | submodules/univer/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 | submodules/univer/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 | submodules/univer/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 | submodules/univer/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 | submodules/univer/node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/types/internal/Subject.d.ts:28 |
Accessors
observed
get observed(): boolean
Returns
boolean
Inherited from
Subject.observed
Defined in
submodules/univer/node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/types/internal/Subject.d.ts:36
Methods
asObservable()
asObservable(): Observable<[T, EventState]>
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
Defined in
submodules/univer/node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/types/internal/Subject.d.ts:43
clearObservers()
clearObservers(): void
Returns
void
Defined in
submodules/univer/packages/core/src/observer/observable.ts:100 (opens in a new tab)
complete()
complete(): void
Returns
void
Overrides
Subject.complete
Defined in
submodules/univer/packages/core/src/observer/observable.ts:79 (opens in a new tab)
emitEvent()
emitEvent(event): INotifyObserversReturn
Parameters
Parameter | Type |
---|---|
event | T |
Returns
INotifyObserversReturn
Defined in
submodules/univer/packages/core/src/observer/observable.ts:105 (opens in a new tab)
error()
error(err): void
Parameters
Parameter | Type |
---|---|
err | any |
Returns
void
Inherited from
Subject.error
Defined in
submodules/univer/node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/types/internal/Subject.d.ts:33
forEach()
forEach(next)
forEach(next): Promise<void>
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
Defined in
submodules/univer/node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/types/internal/Observable.d.ts:97
forEach(next, promiseCtor)
forEach(next, promiseCtor): Promise<void>
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
Defined in
submodules/univer/node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/types/internal/Observable.d.ts:109
lift()
lift<R>(operator): Observable<R>
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
Defined in
submodules/univer/node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/types/internal/Subject.d.ts:31
next()
next(): void
Returns
void
Deprecated
Use emitEvent
instead.
Overrides
Subject.next
Defined in
submodules/univer/packages/core/src/observer/observable.ts:70 (opens in a new tab)
pipe()
pipe(undefined)
pipe(): Observable<[T, EventState]>
Returns
Observable
<[T
, EventState
]>
Inherited from
Subject.pipe
Defined in
submodules/univer/node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/types/internal/Observable.d.ts:110
pipe(op1)
pipe<A>(op1): Observable<A>
Type Parameters
Type Parameter |
---|
A |
Parameters
Parameter | Type |
---|---|
op1 | OperatorFunction <[T , EventState ], A > |
Returns
Observable
<A
>
Inherited from
Subject.pipe
Defined in
submodules/univer/node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/types/internal/Observable.d.ts:111
pipe(op1, op2)
pipe<A, B>(op1, op2): Observable<B>
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
Defined in
submodules/univer/node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/types/internal/Observable.d.ts:112
pipe(op1, op2, op3)
pipe<A, B, C>(
op1,
op2,
op3): Observable<C>
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
Defined in
submodules/univer/node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/types/internal/Observable.d.ts:113
pipe(op1, op2, op3, op4)
pipe<A, B, C, D>(
op1,
op2,
op3,
op4): Observable<D>
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
Defined in
submodules/univer/node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/types/internal/Observable.d.ts:114
pipe(op1, op2, op3, op4, op5)
pipe<A, B, C, D, E>(
op1,
op2,
op3,
op4,
op5): Observable<E>
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
Defined in
submodules/univer/node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/types/internal/Observable.d.ts:115
pipe(op1, op2, op3, op4, op5, op6)
pipe<A, B, C, D, E, F>(
op1,
op2,
op3,
op4,
op5,
op6): Observable<F>
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
Defined in
submodules/univer/node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/types/internal/Observable.d.ts:116
pipe(op1, op2, op3, op4, op5, op6, op7)
pipe<A, B, C, D, E, F, G>(
op1,
op2,
op3,
op4,
op5,
op6,
op7): Observable<G>
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
Defined in
submodules/univer/node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/types/internal/Observable.d.ts:117
pipe(op1, op2, op3, op4, op5, op6, op7, op8)
pipe<A, B, C, D, E, F, G, H>(
op1,
op2,
op3,
op4,
op5,
op6,
op7,
op8): Observable<H>
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
Defined in
submodules/univer/node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/types/internal/Observable.d.ts:118
pipe(op1, op2, op3, op4, op5, op6, op7, op8, op9)
pipe<A, B, C, D, E, F, G, H, I>(
op1,
op2,
op3,
op4,
op5,
op6,
op7,
op8,
op9): Observable<I>
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
Defined in
submodules/univer/node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/types/internal/Observable.d.ts:119
pipe(op1, op2, op3, op4, op5, op6, op7, op8, op9, operations)
pipe<A, B, C, D, E, F, G, H, I>(
op1,
op2,
op3,
op4,
op5,
op6,
op7,
op8,
op9, ...
operations): Observable<unknown>
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
Defined in
submodules/univer/node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/types/internal/Observable.d.ts:120
subscribe()
subscribe(): Subscription
Returns
Subscription
Deprecated
Use subscribeEvent
instead.
Overrides
Subject.subscribe
Defined in
submodules/univer/packages/core/src/observer/observable.ts:65 (opens in a new tab)
subscribeEvent()
subscribeEvent(observer): Subscription
Parameters
Parameter | Type |
---|---|
observer | IEventObserver <T > | (evt , state ) => unknown |
Returns
Subscription
Defined in
submodules/univer/packages/core/src/observer/observable.ts:84 (opens in a new tab)
toPromise()
toPromise(undefined)
toPromise(): Promise<undefined | [T, EventState]>
Returns
Promise
<undefined
| [T
, EventState
]>
Deprecated
Replaced with firstValueFrom and lastValueFrom. Will be removed in v8. Details: https://rxjs.dev/deprecations/to-promise (opens in a new tab)
Inherited from
Subject.toPromise
Defined in
submodules/univer/node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/types/internal/Observable.d.ts:122
toPromise(PromiseCtor)
toPromise(PromiseCtor): Promise<undefined | [T, EventState]>
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 (opens in a new tab)
Inherited from
Subject.toPromise
Defined in
submodules/univer/node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/types/internal/Observable.d.ts:124
toPromise(PromiseCtor)
toPromise(PromiseCtor): Promise<undefined | [T, EventState]>
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 (opens in a new tab)
Inherited from
Subject.toPromise
Defined in
submodules/univer/node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/types/internal/Observable.d.ts:126
unsubscribe()
unsubscribe(): void
Returns
void
Overrides
Subject.unsubscribe
Defined in
submodules/univer/packages/core/src/observer/observable.ts:74 (opens in a new tab)