Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ember-polyfills/ember-router-service-refresh-polyfill
Polyfill for RFC 631 https://emberjs.github.io/rfcs/0631-refresh-method-for-router-service.html
https://github.com/ember-polyfills/ember-router-service-refresh-polyfill
ember emberjs polyfill
Last synced: 3 months ago
JSON representation
Polyfill for RFC 631 https://emberjs.github.io/rfcs/0631-refresh-method-for-router-service.html
- Host: GitHub
- URL: https://github.com/ember-polyfills/ember-router-service-refresh-polyfill
- Owner: ember-polyfills
- License: mit
- Created: 2021-03-18T22:50:34.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2022-11-15T17:13:42.000Z (about 2 years ago)
- Last Synced: 2024-10-05T15:53:42.237Z (3 months ago)
- Topics: ember, emberjs, polyfill
- Language: JavaScript
- Homepage:
- Size: 493 KB
- Stars: 11
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
Awesome Lists containing this project
README
ember-router-service-refresh-polyfill
==============================================================================Polyfills the RouterService#refresh method as described in [RFC 631](https://emberjs.github.io/rfcs/0631-refresh-method-for-router-service.html).
Compatibility
------------------------------------------------------------------------------* Ember.js v3.4 or above. The polyfill is disabled in Ember 4.1 and above.
* Ember CLI v3.4 or above
* Embroider safe and optimized
* Node.js v12 or aboveInstallation
------------------------------------------------------------------------------```
ember install ember-router-service-refresh-polyfill
```Usage
------------------------------------------------------------------------------This addon polyfills the RouterService#refresh method which refreshes all currently active routes, doing a full transition.
If a `routeName` is provided and refers to a currently active route,
it will refresh only that route and its descendents.It returns a [Transition](https://api.emberjs.com/ember/release/classes/Transition) that will be resolved once the refresh is complete.
All resetController, beforeModel, model, afterModel, redirect, and setupController
hooks will be called again. You will get new data from the model hook.### Example
```js
import { action } from '@ember/object';
import { inject as service } from '@ember/service';
import Component from '@glimmer/component';export default class VeryRealComponent extends Component {
@service('router') routerService;@action
refreshAllActiveRoutes() {
this.routerService.refresh();
}@action
refreshNamedActiveRoute() {
this.routerService.refresh('some-active-route-name');
}
}
```Contributing
------------------------------------------------------------------------------See the [Contributing](CONTRIBUTING.md) guide for details.
License
------------------------------------------------------------------------------This project is licensed under the [MIT License](LICENSE.md).