JavaScript double colon (bind operator)

No. The bind operator (spec proposal) comes in two flavours:

  • Method extraction

    ::obj.method     ≡ obj.method.bind(obj)
    
  • “virtual method” calls

    obj::function    ≡ function.bind(obj)
    obj::function(…) ≡ function.call(obj, …)
    

Neither of them feature partial application. For what you want, you should use an arrow function:

(...args) => this.handleStuff('stuff', ...args) ≡ this.handleStuff.bind(this, 'stuff')

Leave a Comment