API Reference
@univerjs
@univerjs/core
classes
Eventsubject

@univerjs/core v0.4.2Docs


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

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

PropertyModifierTypeDescriptionInherited fromDefined in
closedpublicboolean-Subject.closedsubmodules/univer/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.hasErrorsubmodules/univer/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.isStoppedsubmodules/univer/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.observerssubmodules/univer/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.operatorsubmodules/univer/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.sourcesubmodules/univer/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.thrownErrorsubmodules/univer/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.createsubmodules/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

ParameterType
eventT

Returns

INotifyObserversReturn

Defined in

submodules/univer/packages/core/src/observer/observable.ts:105 (opens in a new tab)


error()

error(err): void

Parameters

ParameterType
errany

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
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

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
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

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

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

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
ParameterType
op1OperatorFunction<[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
ParameterType
op1OperatorFunction<[T, EventState], A>
op2OperatorFunction<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
ParameterType
op1OperatorFunction<[T, EventState], A>
op2OperatorFunction<A, B>
op3OperatorFunction<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
ParameterType
op1OperatorFunction<[T, EventState], A>
op2OperatorFunction<A, B>
op3OperatorFunction<B, C>
op4OperatorFunction<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
ParameterType
op1OperatorFunction<[T, EventState], A>
op2OperatorFunction<A, B>
op3OperatorFunction<B, C>
op4OperatorFunction<C, D>
op5OperatorFunction<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
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

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
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

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
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

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
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

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
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

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

ParameterType
observerIEventObserver<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
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 (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
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 (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)


Copyright © 2021-2024 DreamNum Co,Ltd. All Rights Reserved.