Options
All
  • Public
  • Public/Protected
  • All
Menu

Class RemoteFileSystemProxyFactory<T>

Type parameters

  • T: object

Hierarchy

  • JsonRpcProxyFactory<T>
    • RemoteFileSystemProxyFactory

Index

Constructors

constructor

  • Build a new JsonRpcProxyFactory.

    Type parameters

    • T: object

    Parameters

    • Optional target: any

      The object to expose to JSON-RPC methods calls. If this is omitted, the proxy won't be able to handle requests, only send them.

    Returns RemoteFileSystemProxyFactory<T>

Properties

Protected connectionPromise

connectionPromise: Promise<MessageConnection>

Protected connectionPromiseResolve

connectionPromiseResolve: (connection: MessageConnection) => void

Type declaration

    • (connection: MessageConnection): void
    • Parameters

      • connection: MessageConnection

      Returns void

Protected Readonly onDidCloseConnectionEmitter

onDidCloseConnectionEmitter: Emitter<void>

Protected Readonly onDidOpenConnectionEmitter

onDidOpenConnectionEmitter: Emitter<void>

Optional target

target: any

Methods

createProxy

  • createProxy(): JsonRpcProxy<T>
  • Create a Proxy exposing the interface of an object of type T. This Proxy can be used to do JSON-RPC method calls on the remote target object as if it was local.

    If T implements JsonRpcServer then a client is used as a target object for a remote target object.

    Returns JsonRpcProxy<T>

Protected deserializeError

  • deserializeError(capturedError: Error, e: any): any

get

  • get(target: T, p: string | number | symbol, receiver: any): any
  • Get a callable object that executes a JSON-RPC method call.

    Getting a property on the Proxy object returns a callable that, when called, executes a JSON-RPC call. The name of the property defines the method to be called. The callable takes a variable number of arguments, which are passed in the JSON-RPC method call.

    For example, if you have a Proxy object:

    let fooProxyFactory = JsonRpcProxyFactory<Foo>('/foo')
    let fooProxy = fooProxyFactory.createProxy()
    

    accessing fooProxy.bar will return a callable that, when called, executes a JSON-RPC method call to method bar. Therefore, doing fooProxy.bar() will call the bar method on the remote Foo object.

    Parameters

    • target: T

      unused.

    • p: string | number | symbol

      The property accessed on the Proxy object.

    • receiver: any

      unused.

    Returns any

    A callable that executes the JSON-RPC call.

Protected isNotification

  • isNotification(p: string | number | symbol): boolean
  • Return whether the given property represents a notification.

    A property leads to a notification rather than a method call if its name begins with notify or on.

    Parameters

    • p: string | number | symbol

      The property being called on the proxy.

    Returns boolean

    Whether p represents a notification.

listen

  • listen(connection: MessageConnection): void
  • Connect a MessageConnection to the factory.

    This connection will be used to send/receive JSON-RPC requests and response.

    Parameters

    • connection: MessageConnection

    Returns void

Protected onNotification

  • onNotification(method: string, ...args: any[]): void
  • Process an incoming JSON-RPC notification.

    Same as onRequest, but called on incoming notifications rather than methods calls.

    Parameters

    • method: string
    • Rest ...args: any[]

    Returns void

Protected onRequest

  • onRequest(method: string, ...args: any[]): Promise<any>
  • Process an incoming JSON-RPC method call.

    onRequest is called when the JSON-RPC connection received a method call request. It calls the corresponding method on target.

    The return value is a Promise object that is resolved with the return value of the method call, if it is successful. The promise is rejected if the called method does not exist or if it throws.

    Parameters

    • method: string
    • Rest ...args: any[]

    Returns Promise<any>

    A promise of the method call completion.

Protected serializeError

  • serializeError(e: any): any

Protected waitForConnection

  • waitForConnection(): void
  • Returns void