javascript - How do you inject a factory function with Aurelia's DI container? -


i'd make third-party object on window injectable can test functionality independent of third-party service. component i'm trying build simple wrapper around disqus embedded comments. factory use simple as

() => window.disqus 

has been able or know if possible?

use registerinstance string key this:

container.registerinstance('disqus', window.disqus); 

then can inject disqus instance view models this:

import {inject} 'aurelia-framework';  @inject('disqus') export class foo {   constructor(disqus) {     this.disqus = disqus;   }   ... } 

Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -