Last active
August 29, 2015 14:18
-
-
Save plwalters/9e66a2a258023e5c987f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {inject} from 'aurelia-framework'; | |
import {HttpClient} from 'aurelia-http-client'; | |
var autobind = fnDecorator(function(target, key, descriptor){ | |
let fn = descriptor.value; | |
descriptor.value = function autobound(){ | |
return fn.bind(this,arguments); | |
}; | |
return descriptor; | |
}); | |
export class au { | |
this.inject = inject; | |
this.http = HttpClient; | |
this.autobind = autobind; | |
} | |
// Then in your module - | |
import {Behavior} from 'aurelia-framework'; | |
import {au} from './decorators'; | |
@au.inject(Behavior) | |
class Whatever { | |
constructor(behavior){ | |
this.behavior = behavior; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment