dscsa / client

Browser single page application for logging written with Aurelia
3 stars 1 forks source link

Refactor http to use a context pattern rather than a factory pattern #186

Closed akircher closed 8 years ago

akircher commented 8 years ago

From this

function init(ctx) {
  return function api() {
     ctx.path
  }
}

into this


function api() {
   this.ctx.path
}

return api.bind(ctx)
akircher commented 8 years ago

Not doing this because of http sugar methods http.context, http.get etc would also ALL need to be bound, which is less elegant than the factory method. Just needs a general refactor instead.