Comments (21)
Glad that you like it :)
In fact it does cover error states as well. I've updated the docs to reflect that.
from ember-asset-loader.
from ember-asset-loader.
I had always figured that this helper would live in the ember-engines
repo itself, and ember-asset-loader
would simply provide some helper methods (i.e. isLoaded()
) in order to simplify its implementation.
I can't imagine the helper being very useful outside of ember-engines
, though maybe someone else can think of a use case in which it would be?
from ember-asset-loader.
I think my thought was that this addon and its main service is what is responsible for loading bundles, so it is the thing that should provide the helper. Though it's helper should likely be load-asset-bundle
or something, because it's not 100% engine focused...
Am I on the wrong track?
from ember-asset-loader.
Wouldn't the helper also need to actually register the engine after it had finished downloading the bundle?
from ember-asset-loader.
Hmm. What do you mean? Loading the bundle would mean that the modules that the {{mount
keyword looks for would be present, right?
Note: I haven't ran the code I pasted above in the description. So perhaps I'm missing something obvious...
from ember-asset-loader.
Its entirely possible that I am actually missing something obvious, but I would have thought that the helper would need to register the engine with the application after successfully downloading its bundle.
So essentially, the call to loadBundle()
would look something like:
// Load un-registered engine
this.get("assetLoader").loadBundle(engineName).then(() => {
// Get engine
const engine = window.require(`${engineName}/engine`).default;
// Register engine with application
owner.register(`engine:${engineName}`, engine);
// Update this._engineName
this._engineName = engineName;
// Trigger recompution of helper
this.recompute();
});
from ember-asset-loader.
Ya, I just think that manual registration shouldn't be needed. Once the bundle is loaded, the engine-name/engine
module will be present in the module registry so that when the owner.lookup('engine:engine-name-here')
happens, this code in the resolver would return the proper value.
from ember-asset-loader.
Ah I see, if thats the case and it works then keeping the helper in the asset-loader
repo sounds good to me.
from ember-asset-loader.
Overall, this seems like a reasonable addition to this addon.
Though it's helper should likely be load-asset-bundle or something, because it's not 100% engine focused...
Agreed. Either load-bundle
or load-asset-bundle
seems good for consistency with the terminology used elsewhere by this addon.
Once the bundle is loaded, the engine-name/engine module will be present in the module registry so that when the owner.lookup('engine:engine-name-here') happens, this code in the resolver would return the proper value.
This is correct, and essentially what we do for routable engines.
from ember-asset-loader.
Yep, this sounds good.
from ember-asset-loader.
The most recent Ember.js times newsletter had a reference to this, that reminded me about this addon I once wrote: ember-lazy-mount
I guess this is not really relevant, since it uses a component instead of a template helper, but maybe you still find it useful. ✌️
from ember-asset-loader.
@buschtoens your addon covers an important usecase - loading state. Probably should also cover error state?
How would that be handled in the load-bundle
or load-asset-bundle
helper?
from ember-asset-loader.
@rwjblue @dgeb @stefanpenner what you think about make ember-lazy-mount as our solution to lazy loading route-less engines?
makes sense when looking at engines RFC
from ember-asset-loader.
I know this might come up, so I'll address it right away: I have no problem with stripping out ember-concurrency(-decorators) and ember-decorators to reduce the bundle size for consumers that don't use these addons.
from ember-asset-loader.
yup @buschtoens and as asset-loader was written in ES6, we would have to remove the typescript as well.
from ember-asset-loader.
I've defactored ember-lazy-mount in buschtoens/ember-lazy-mount#4 to not use any dependencies except babel and htmlbars in order to decrease bundle size and also reverted back to the Ember Object Model, to make it possible to merge this code into ember-asset-loader
and / or ember-engines
.
from ember-asset-loader.
Now that we know that Lazy Loading on ember-engines will work more friendly replacing ember-asset-loader
with embroider
. I think that we can make ember-asset-loader
complete, following the RFC and Roadmap 1.0 and add ember-lazy-mount
solution here.
what you think guys?
cc: @rwjblue @dgeb @stefanpenner
from ember-asset-loader.
(: >>> [🥇 UP 🥇] <<< :)
from ember-asset-loader.
Someone just needs to do the work 🤷♂️
from ember-asset-loader.
thanks @rwjblue
@buschtoens can you open a pull request on ember-engines adding your solution in lazy-mount
please?
It's your merit buddy!
from ember-asset-loader.
Related Issues (20)
- CI/tests failing HOT 2
- storeConfigInMeta
- Need file order in configuration. HOT 6
- assetLoader Service is required in host route and component unit tests HOT 3
- Weird fingerprinting of images HOT 1
- How use contentFor in engines HOT 2
- manifest-inserter causes index.html to show up as changed on every rebuild HOT 21
- Should not include empty files in generated asset manifest. HOT 3
- Support for loading non-engines assets lazily when needed. HOT 1
- Improve CI to avoid dependency drift HOT 2
- On Windows, engine asset paths use back slashes instead of forward slashes HOT 7
- CSS asset loader, `onload` event called too soon. (can only repro on firefox) HOT 3
- Need an option to add Subresource Integrity(SRI) in engine assets HOT 1
- The loader when in node land does nothing, can we teach it to put link/script tags in the DOM?
- option to make resetting asset state in tests less noisy HOT 3
- Multiple meta tags inserted into head-footer when multiple addons use ManifestGenerator HOT 1
- Repeatedly performing npm-install fails with EISGIT: Appears to be a git repo or submodule HOT 3
- No manifest generated for engine when external addon extends from ember-asset-loader HOT 4
- API request: the ability to retrieve the list of assets loaded/in the cache HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ember-asset-loader.