• Delegates property access of proxy to given source object. The proxy.prototype is set to the given source object.

    Type Parameters

    • SourceType extends object

    Parameters

    • source: SourceType

      the object which should be wrapped.

    Returns SourceType

    the proxy.

    const src = {x: 1};
    const proxy = {
    y: 2
    };
    const a = delegate(src, proxy);
    a === proxy // -> true
    a.y // -> 2
    a.x // -> 1
  • Delegates property access of proxy to given source object. The proxy.prototype is set to the given source object.

    Type Parameters

    • SourceType extends object
    • ProxyType extends object

    Parameters

    Returns SourceType & ProxyType

    the proxy.

    const src = {x: 1};
    const proxy = {
    y: 2
    };
    const a = delegate(src, proxy);
    a === proxy; // -> true
    a.y // -> 2
    a.x // -> 1