1
1
ember-router-service-refresh-polyfill
2
2
==============================================================================
3
3
4
- [ Short description of the addon. ]
4
+ Polyfills the RouterService#refresh method as described in [ RFC 631 ] ( https://emberjs.github.io/rfcs/0631-refresh-method-for-router-service.html ) .
5
5
6
6
7
7
Compatibility
8
8
------------------------------------------------------------------------------
9
9
10
- * Ember.js v3.16 or above
11
- * Ember CLI v2.13 or above
10
+ * Ember.js v3.4 or above
11
+ * Ember CLI v3.4 or above
12
12
* Node.js v10 or above
13
13
14
14
@@ -23,8 +23,36 @@ ember install ember-router-service-refresh-polyfill
23
23
Usage
24
24
------------------------------------------------------------------------------
25
25
26
- [ Longer description of how to use the addon in apps. ]
26
+ This addon polyfills the RouterService#refresh method which refreshes all currently active routes, doing a full transition.
27
27
28
+ If a ` routeName ` is provided and refers to a currently active route,
29
+ it will refresh only that route and its descendents.
30
+
31
+ It returns a [ Transition] ( https://api.emberjs.com/ember/release/classes/Transition ) that will be resolved once the refresh is complete.
32
+ All resetController, beforeModel, model, afterModel, redirect, and setupController
33
+ hooks will be called again. You will get new data from the model hook.
34
+
35
+ ### Example
36
+
37
+ ``` js
38
+ import Component from ' @glimmer/component' ;
39
+ import { inject as service } from ' @ember/service' ;
40
+ import { action } from ' @ember/object' ;
41
+
42
+ export default class VeryRealComponent extends Component {
43
+ @service (' router' ) routerService;
44
+
45
+ @action
46
+ refreshAllActiveRoutes () {
47
+ this .routerService .refresh ();
48
+ }
49
+
50
+ @action
51
+ refreshNamedActiveRoute () {
52
+ this .routerService .refresh (' some-active-route-name' );
53
+ }
54
+ }
55
+ ```
28
56
29
57
Contributing
30
58
------------------------------------------------------------------------------
0 commit comments