File

src/lib/proxy.remote-method.ts

Extends

BaseRemoteMethod

Index

Properties
Methods

Constructor

constructor(remoteMethod: BaseRemoteMethod, injector: Injector | null, metadata: BaseRemoteMethodMetadata)
Parameters :
Name Type Optional
remoteMethod BaseRemoteMethod No
injector Injector | null No
metadata BaseRemoteMethodMetadata No

Methods

Protected Async _call
_call(parameters?: SourceParameter)
Inherited from BaseRemoteMethod
Parameters :
Name Type Optional
parameters SourceParameter Yes
Returns : Promise<any>
Public Abstract transformParameters
transformParameters(parameters?: SourceParameter)
Parameters :
Name Type Optional
parameters SourceParameter Yes
Returns : TargetParameter | Promise
Public Async call
call(parameters?: Parameter)
Inherited from BaseRemoteMethod
Parameters :
Name Type Optional
parameters Parameter Yes
Returns : Promise<ReturnType>
Public executed
executed(result: ReturnType)
Inherited from BaseRemoteMethod
Parameters :
Name Type Optional
result ReturnType No
Returns : void
Public pauseRefresh
pauseRefresh()
Inherited from BaseRemoteMethod
Returns : void
Public refresh
refresh()
Inherited from BaseRemoteMethod
Returns : void
Public resumeRefresh
resumeRefresh()
Inherited from BaseRemoteMethod
Returns : void

Properties

Public executed$
Type : Subject<ReturnType>
Default value : new Subject<ReturnType>()
Inherited from BaseRemoteMethod
Public executionsInProgress$
Type : CounterSubject
Default value : new CounterSubject()
Inherited from BaseRemoteMethod
Public Readonly injector
Type : Injector
Inherited from BaseRemoteMethod
import {
  Inject,
  Injectable,
  INJECTOR,
  Injector,
} from '@angular/core';
import {
  BaseRemoteMethod,
  BaseRemoteMethodMetadata,
} from './base.remote-method';
import {
  REMOTE_METHOD_META_DATA,
  RXAP_PROXY_REMOTE_METHOD_TARGET,
} from './tokens';

@Injectable()
export abstract class ProxyRemoteMethod<ReturnType = any, SourceParameter = any, TargetParameter = SourceParameter>
  extends BaseRemoteMethod<ReturnType, SourceParameter> {

  constructor(
    @Inject(RXAP_PROXY_REMOTE_METHOD_TARGET)
    private readonly remoteMethod: BaseRemoteMethod,
    @Inject(INJECTOR)
      injector: Injector | null = null,
    @Inject(REMOTE_METHOD_META_DATA)
      metadata: BaseRemoteMethodMetadata = remoteMethod.metadata,
  ) {
    super(injector, metadata);
  }

  public abstract transformParameters(parameters?: SourceParameter): TargetParameter | Promise<TargetParameter>;

  protected async _call(parameters?: SourceParameter): Promise<any> {
    return this.remoteMethod.call(await this.transformParameters(parameters));
  }

}

results matching ""

    No results matching ""