Skip to content

Instantly share code, notes, and snippets.

@plwalters
Last active August 29, 2015 14:18
Show Gist options
  • Save plwalters/9e66a2a258023e5c987f to your computer and use it in GitHub Desktop.
Save plwalters/9e66a2a258023e5c987f to your computer and use it in GitHub Desktop.
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