[ember] - Add missing Ember.Route#intermediateTransitionTo method (#27031)

* Ember.Route#intermediateTransitionTo

* add self as contributor
This commit is contained in:
Mike North 2018-07-05 09:58:21 -07:00 committed by Mohamed Hegazy
parent dae079e5be
commit 2cf2ef209d
3 changed files with 28 additions and 0 deletions

View File

@ -7,6 +7,7 @@
// Theron Cross <https://github.com/theroncross>
// Martin Feckie <https://github.com/mfeckie>
// Alex LaFroscia <https://github.com/alexlafroscia>
// Mike North <https://github.com/mike-north>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.4
@ -1990,6 +1991,19 @@ declare module 'ember' {
*/
transitionTo(name: string, ...object: any[]): Transition;
// https://emberjs.com/api/ember/3.2/classes/Route/methods/intermediateTransitionTo?anchor=intermediateTransitionTo
/**
* Perform a synchronous transition into another route without attempting to resolve promises,
* update the URL, or abort any currently active asynchronous transitions
* (i.e. regular transitions caused by transitionTo or URL changes).
*
* @param name the name of the route or a URL
* @param object the model(s) or identifier(s) to be used while
* transitioning to the route.
* @returns the Transition object associated with this attempted transition
*/
intermediateTransitionTo(name: string, ...object: any[]): Transition;
// properties
/**
* The controller associated with this route.

View File

@ -92,4 +92,13 @@ class RouteUsingClass extends Route.extend({
beforeModel(this: RouteUsingClass) {
return 'beforeModel can return anything, not just promises';
}
intermediateTransitionWithoutModel() {
this.intermediateTransitionTo('some-route');
}
intermediateTransitionWithModel() {
this.intermediateTransitionTo('some.other.route', { });
}
intermediateTransitionWithMultiModel() {
this.intermediateTransitionTo('some.other.route', 1, 2, { });
}
}

View File

@ -34,6 +34,11 @@ const RouterServiceConsumer = Ember.Service.extend({
Ember.get(this, 'router')
.transitionTo('some.other.route', model);
},
transitionWithMultiModel() {
const model = Ember.Object.create();
Ember.get(this, 'router')
.transitionTo('some.other.route', model, model);
},
transitionWithModelAndOptions() {
const model = Ember.Object.create();
Ember.get(this, 'router')