I've just tried aurelia's Get started application and noticed that when open in two browsers (chrome and ff) it keeps navigation in sync. It looks like router instance resides in application scope. I didn't find anything about scopes in documentation so the question is
What are the scopes in aurelia, how can I put/remove object in session/page/whatever scope, see what objects are in particular scope ?
Best regards, Eugene.
I've just tried aurelia's Get started application and noticed that when open in two browsers (chrome and ff) it keeps navigation in sync.
The gulp task includes a navigation sync plugin that lets you keep the app open in multiple browsers and refreshes each browser based on your behavior in the others.
It looks like router instance resides in application scope. I didn't find anything about scopes in documentation so the question is what are the scopes in aurelia
That depends on the object. In general, you create them. All the disparate parts of Aurelia are typically handled as es6 classes. You can use the static metadata
method to define what kind of scope your class should have. Giving it a transient
annotation will tell Aurelia to instantiate new versions every time the dependency is injected. Otherwise, the default singleton
annotation will instruct Aurelia to instantiate the object once, keep it in memory, and inject the same instantiation as requested.
how can I put/remove object in session/page/whatever scope, see what objects are in particular scope ?
You don't so much inspect which objects are alive. You let Aurelia handle that intelligently. Instead, you ask Aurelia for things you are interested in. Each class can handle its own activation and deactivation through the respective methods.
You can read more about these topics on the docs:
http://aurelia.io/hub.html#/doc/article/aurelia/dependency-injection/latest/dependency-injection-basics
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With