Skip to content

ember-polyfills/ember-router-service-refresh-polyfill

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

cf1cdfc · Mar 20, 2021

History

12 Commits
Mar 20, 2021
Mar 20, 2021
Mar 20, 2021
Mar 20, 2021
Mar 20, 2021
Mar 18, 2021
Mar 18, 2021
Mar 18, 2021
Mar 18, 2021
Mar 18, 2021
Mar 18, 2021
Mar 18, 2021
Mar 18, 2021
Mar 18, 2021
Mar 18, 2021
Mar 20, 2021
Mar 18, 2021
Mar 20, 2021
Mar 18, 2021
Mar 18, 2021
Mar 20, 2021
Mar 20, 2021
Mar 18, 2021
Mar 18, 2021
Mar 20, 2021
Mar 18, 2021
Mar 20, 2021

Repository files navigation

ember-router-service-refresh-polyfill

Polyfills the RouterService#refresh method as described in RFC 631.

Compatibility

  • Ember.js v3.4 or above
  • Ember CLI v3.4 or above
  • Node.js v10 or above

Installation

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 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

import Component from '@glimmer/component';
import { inject as service } from '@ember/service';
import { action } from '@ember/object';

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 guide for details.

License

This project is licensed under the MIT License.