RemoteValue
Extends:
Remote value representation locally.
Example:
import { RemoteValue } from 'remote-context';
const proxy = new RemoteValue(remoteSession, reference, value);
Static Method Summary
Static Public Methods | ||
public static |
isRemoteValue(proxy: RemoteValueProxy | *): boolean Check if the give value is a proxy of remote value. |
|
public static |
observe(proxy: RemoteValueProxy, onNext: function | null, onError: function | null, onComplete: function | null): function(): boolean} Observe for any change on the given remote value proxy. |
|
public static |
resolve(value: RemoteValueProxy | *): Promise Resolve the given value. |
|
public static |
reveal(proxy: RemoteValueProxy): RemoteValue Get the remote value instance of the given proxy. |
|
public static |
revoke(proxy: *): void If the given value is a RemoteValueProxy, revoke the value proxy. |
Constructor Summary
Public Constructor | ||
public |
constructor(session: RemoteSession, reference: Reference, value: *): RemoteValueProxy Create a RemoteValue class and a proxy to the given value. |
Member Summary
Public Members | ||
public |
[kError]: * |
|
public |
[kProxyData]: * |
|
public get |
proxy: * |
|
public get |
target: * |
Method Summary
Public Methods | ||
public |
defineProperty(property: *, descriptor: *): boolean |
|
public |
deleteProperty(property: *): boolean |
|
public |
|
|
public |
reject(error: *) |
|
public |
revoke() |
|
public |
setPrototypeOf(prototype: *): boolean |
Static Public Methods
public static isRemoteValue(proxy: RemoteValueProxy | *): boolean source
Check if the give value is a proxy of remote value.
Params:
Name | Type | Attribute | Description |
proxy | RemoteValueProxy | * | The given value |
public static observe(proxy: RemoteValueProxy, onNext: function | null, onError: function | null, onComplete: function | null): function(): boolean} source
Observe for any change on the given remote value proxy.
Params:
Name | Type | Attribute | Description |
proxy | RemoteValueProxy | The given remove value proxy |
|
onNext | function | null | Called on every change to the given value with the RemoteValueProxy as the first argument |
|
onError | function | null | Called on every error occurred on the given value with an error as first argument |
|
onComplete | function | null | Called when the given value revoked with no arguments |
Return:
function(): boolean} | An subscription object with
|
See:
- https://github.com/tc39/proposal-observable
public static resolve(value: RemoteValueProxy | *): Promise source
Resolve the given value. Reject the value if it's a RemoteValueProxy and an uncaught error accord while using the value (ie. assign property to the value failed). Otherwise, resolve it.
Params:
Name | Type | Attribute | Description |
value | RemoteValueProxy | * | The given value |
public static reveal(proxy: RemoteValueProxy): RemoteValue source
Get the remote value instance of the given proxy.
Params:
Name | Type | Attribute | Description |
proxy | RemoteValueProxy | The given proxy |
Throw:
If the given value is not a RemoteValueProxy. |
public static revoke(proxy: *): void source
If the given value is a RemoteValueProxy, revoke the value proxy. Otherwise, do nothing.
Params:
Name | Type | Attribute | Description |
proxy | * | The given value |
Return:
void |
Public Constructors
public constructor(session: RemoteSession, reference: Reference, value: *): RemoteValueProxy source
Create a RemoteValue class and a proxy to the given value.
Params:
Name | Type | Attribute | Description |
session | RemoteSession | The current value remote session |
|
reference | Reference | he value reference for further updates to the remote peer |
|
value | * | The given value |
Public Members
public [kError]: * source
public [kProxyData]: * source
public get proxy: * source
public get target: * source
Public Methods
public defineProperty(property: *, descriptor: *): boolean source
Params:
Name | Type | Attribute | Description |
property | * | ||
descriptor | * |
public reject(error: *) source
Params:
Name | Type | Attribute | Description |
error | * |