# Function createProxyFunctions

- createProxyFunctions(
  source: any,
  target: any,
  bind: any,
  fnNames: any,
  latebind?: boolean,
  ): any

  Builds proxy functions on the `to` object which pass through to the `from` object.

  For each key in `fnNames`, creates a proxy function on the `to` object. The proxy function calls the real function on the `from` object.

  #### Example:

  This example creates an new class instance whose functions are prebound to the new'd object.

      class Foo {
        constructor(data) {
          // Binds all functions from Foo.prototype to 'this',
          // then copies them to 'this'
          bindFunctions(Foo.prototype, this, this);
          this.data = data;
        }

        log() {
          console.log(this.data);
        }
      }

      let myFoo = new Foo([1,2,3]);
      var logit = myFoo.log;
      logit(); // logs [1, 2, 3] from the myFoo 'this' instance

  #### Example:

  This example creates a bound version of a service function, and copies it to another object

      var SomeService = {
        this.data = [3, 4, 5];
        this.log = function() {
          console.log(this.data);
        }
      }

      // Constructor fn
      function OtherThing() {
        // Binds all functions from SomeService to SomeService,
        // then copies them to 'this'
        bindFunctions(SomeService, this, SomeService);
      }

      let myOtherThing = new OtherThing();
      myOtherThing.log(); // logs [3, 4, 5] from SomeService's 'this'

  #### Parameters

  - source: any

    A function that returns the source object which contains the original functions to be bound

  - target: any

    A function that returns the target object which will receive the bound functions

  - bind: any

    A function that returns the object which the functions will be bound to

  - fnNames: any

    The function names which will be bound (Defaults to all the functions found on the 'from' object)

  - latebind: boolean = false

    If true, the binding of the function is delayed until the first time it's invoked

  #### Returns any

  - Defined in src/shared/common.js:86