@univerjscoreclassesEventsubject

@univerjs/core v0.5.4


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

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

PropertyModifierTypeDescriptionInherited fromDefined in
closedpublicboolean-Subject.closedpackages/api/tmp/univer-pro/node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/types/internal/Subject.d.ts:12
hasErrorpublicbooleanDeprecated Internal implementation detail, do not use directly. Will be made internal in v8.Subject.hasErrorpackages/api/tmp/univer-pro/node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/types/internal/Subject.d.ts:19
isStoppedpublicbooleanDeprecated Internal implementation detail, do not use directly. Will be made internal in v8.Subject.isStoppedpackages/api/tmp/univer-pro/node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/types/internal/Subject.d.ts:17
observerspublicObserver<[T, EventState]>[]Deprecated Internal implementation detail, do not use directly. Will be made internal in v8.Subject.observerspackages/api/tmp/univer-pro/node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/types/internal/Subject.d.ts:15
operatorpublicundefined | Operator<any, [T, EventState]>Deprecated Internal implementation detail, do not use directly. Will be made internal in v8.Subject.operatorpackages/api/tmp/univer-pro/node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/types/internal/Observable.d.ts:19
sourcepublicundefined | Observable<any>Deprecated Internal implementation detail, do not use directly. Will be made internal in v8.Subject.sourcepackages/api/tmp/univer-pro/node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/types/internal/Observable.d.ts:15
thrownErrorpublicanyDeprecated Internal implementation detail, do not use directly. Will be made internal in v8.Subject.thrownErrorpackages/api/tmp/univer-pro/node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/types/internal/Subject.d.ts:21
createstatic(…args: any[]) => anyCreates 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.createpackages/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

ParameterType
eventT

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

ParameterType
errany

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
ParameterTypeDescription
next(value) => voida 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
ParameterTypeDescription
next(value) => voida handler for each value emitted by the observable
promiseCtorPromiseConstructorLikea 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

ParameterType
operatorOperator<[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
ParameterType
op1OperatorFunction<[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
ParameterType
op1OperatorFunction<[T, EventState], A>
op2OperatorFunction<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
ParameterType
op1OperatorFunction<[T, EventState], A>
op2OperatorFunction<A, B>
op3OperatorFunction<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
ParameterType
op1OperatorFunction<[T, EventState], A>
op2OperatorFunction<A, B>
op3OperatorFunction<B, C>
op4OperatorFunction<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
ParameterType
op1OperatorFunction<[T, EventState], A>
op2OperatorFunction<A, B>
op3OperatorFunction<B, C>
op4OperatorFunction<C, D>
op5OperatorFunction<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
ParameterType
op1OperatorFunction<[T, EventState], A>
op2OperatorFunction<A, B>
op3OperatorFunction<B, C>
op4OperatorFunction<C, D>
op5OperatorFunction<D, E>
op6OperatorFunction<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
ParameterType
op1OperatorFunction<[T, EventState], A>
op2OperatorFunction<A, B>
op3OperatorFunction<B, C>
op4OperatorFunction<C, D>
op5OperatorFunction<D, E>
op6OperatorFunction<E, F>
op7OperatorFunction<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
ParameterType
op1OperatorFunction<[T, EventState], A>
op2OperatorFunction<A, B>
op3OperatorFunction<B, C>
op4OperatorFunction<C, D>
op5OperatorFunction<D, E>
op6OperatorFunction<E, F>
op7OperatorFunction<F, G>
op8OperatorFunction<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
ParameterType
op1OperatorFunction<[T, EventState], A>
op2OperatorFunction<A, B>
op3OperatorFunction<B, C>
op4OperatorFunction<C, D>
op5OperatorFunction<D, E>
op6OperatorFunction<E, F>
op7OperatorFunction<F, G>
op8OperatorFunction<G, H>
op9OperatorFunction<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
ParameterType
op1OperatorFunction<[T, EventState], A>
op2OperatorFunction<A, B>
op3OperatorFunction<B, C>
op4OperatorFunction<C, D>
op5OperatorFunction<D, E>
op6OperatorFunction<E, F>
op7OperatorFunction<F, G>
op8OperatorFunction<G, H>
op9OperatorFunction<H, I>
operationsOperatorFunction<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

ParameterType
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
ParameterType
PromiseCtorPromiseConstructor
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
ParameterType
PromiseCtorPromiseConstructorLike
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