Created
March 20, 2017 19:27
-
-
Save knownasilya/a80d1405919da6239cf09bf1cd3ffb63 to your computer and use it in GitHub Desktop.
mount engine by dynamic name
This file contains hidden or 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
| export default Ember.Helper.extend({ | |
| assetLoader: Ember.inject.service(), | |
| compute([name]) { | |
| if (this.engineName === name && this._resolved) { return name; } | |
| this.engineName = name; | |
| let assetLoader = this.get('assetLoader'); | |
| assetLoader.loadBundle(name) | |
| .then(() => { | |
| this._resolved = true; | |
| this.recompute(); | |
| }); | |
| return null; | |
| } | |
| }); | |
| // usage: {{mount (load-engine boundEngineName)}} |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Example by @mike183