fuse-box / fuse-box-aurelia-loader

MIT License
14 stars 2 forks source link

@autoinject #29

Closed vegarringdal closed 5 years ago

vegarringdal commented 7 years ago

Looks like the typescript helper plugin is needed for this

vegarringdal commented 7 years ago

I was wrong, auto inject works fine as long as its not Element

workaround is declare class Element {}

import {autoinject} from 'aurelia-framework';
declare class Element {}

@autoinject
export class BlurImageCustomAttribute {
  constructor(private element: Element) {
    this.element = element;
  }

  public valueChanged(newImage: HTMLImageElement) {
    if (newImage.complete) {
      drawBlur(this.element, newImage);
    } else {
      newImage.onload = () => drawBlur(this.element, newImage);
    }
  }
}