Skip to content

Commit

Permalink
Remove intimate apis in the router
Browse files Browse the repository at this point in the history
  • Loading branch information
chadhietala committed Apr 2, 2019
1 parent 4de058a commit 271b5e8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 146 deletions.
144 changes: 1 addition & 143 deletions packages/@ember/-internals/routing/lib/system/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,7 @@ import { computed, get, notifyPropertyChange, set } from '@ember/-internals/meta
import { getOwner, Owner } from '@ember/-internals/owner';
import { A as emberA, Evented, Object as EmberObject, typeOf } from '@ember/-internals/runtime';
import { assert, deprecate, info } from '@ember/debug';
import {
APP_CTRL_ROUTER_PROPS,
HANDLER_INFOS,
ROUTER_EVENTS,
TRANSITION_STATE,
} from '@ember/deprecated-features';
import { APP_CTRL_ROUTER_PROPS, ROUTER_EVENTS } from '@ember/deprecated-features';
import EmberError from '@ember/error';
import { assign } from '@ember/polyfills';
import { cancel, once, run, scheduleOnce } from '@ember/runloop';
Expand All @@ -29,9 +24,7 @@ import RouterState from './router_state';
import { MatchCallback } from 'route-recognizer';
import Router, {
InternalRouteInfo,
InternalTransition,
logAbort,
PARAMS_SYMBOL,
QUERY_PARAMS_SYMBOL,
STATE_SYMBOL,
Transition,
Expand Down Expand Up @@ -80,141 +73,6 @@ function defaultWillTransition(
}
}

if (TRANSITION_STATE) {
Object.defineProperty(InternalTransition.prototype, 'state', {
get() {
deprecate(
'You attempted to read "transition.state" which is a private API. You should read the `RouteInfo` object on "transition.to" or "transition.from" which has the public state on it.',
false,
{
id: 'transition-state',
until: '3.9.0',
url: 'https://emberjs.com/deprecations/v3.x#toc_transition-state',
}
);
return this[STATE_SYMBOL];
},
});

Object.defineProperty(InternalTransition.prototype, 'queryParams', {
get() {
deprecate(
'You attempted to read "transition.queryParams" which is a private API. You should read the `RouteInfo` object on "transition.to" or "transition.from" which has the queryParams on it.',
false,
{
id: 'transition-state',
until: '3.9.0',
url: 'https://emberjs.com/deprecations/v3.x#toc_transition-state',
}
);
return this[QUERY_PARAMS_SYMBOL];
},
});

Object.defineProperty(InternalTransition.prototype, 'params', {
get() {
deprecate(
'You attempted to read "transition.params" which is a private API. You should read the `RouteInfo` object on "transition.to" or "transition.from" which has the params on it.',
false,
{
id: 'transition-state',
until: '3.9.0',
url: 'https://emberjs.com/deprecations/v3.x#toc_transition-state',
}
);
return this[PARAMS_SYMBOL];
},
});
}

if (HANDLER_INFOS) {
Object.defineProperty(InternalRouteInfo.prototype, 'handler', {
get() {
deprecate(
'You attempted to read "handlerInfo.handler" which is a private API that will be removed.',
false,
{
id: 'remove-handler-infos',
until: '3.9.0',
url: 'https://emberjs.com/deprecations/v3.x#toc_remove-handler-infos',
}
);
return this.route;
},

set(value: string) {
deprecate(
'You attempted to set "handlerInfo.handler" which is a private API that will be removed.',
false,
{
id: 'remove-handler-infos',
until: '3.9.0',
url: 'https://emberjs.com/deprecations/v3.x#toc_remove-handler-infos',
}
);
this.route = value;
},
});

Object.defineProperty(InternalTransition.prototype, 'handlerInfos', {
get() {
deprecate(
'You attempted to use "transition.handlerInfos" which is a private API that will be removed.',
false,
{
id: 'remove-handler-infos',
until: '3.9.0',
url: 'https://emberjs.com/deprecations/v3.x#toc_remove-handler-infos',
}
);
return this.routeInfos;
},
});

Object.defineProperty(TransitionState.prototype, 'handlerInfos', {
get() {
deprecate(
'You attempted to use "transition.state.handlerInfos" which is a private API that will be removed.',
false,
{
id: 'remove-handler-infos',
until: '3.9.0',
url: 'https://emberjs.com/deprecations/v3.x#toc_remove-handler-infos',
}
);
return this.routeInfos;
},
});

Object.defineProperty(Router.prototype, 'currentHandlerInfos', {
get() {
deprecate(
'You attempted to use "_routerMicrolib.currentHandlerInfos" which is a private API that will be removed.',
false,
{
id: 'remove-handler-infos',
until: '3.9.0',
url: 'https://emberjs.com/deprecations/v3.x#toc_remove-handler-infos',
}
);
return this.currentRouteInfos;
},
});

Router.prototype['getHandler'] = function(name: string) {
deprecate(
'You attempted to use "_routerMicrolib.getHandler" which is a private API that will be removed.',
false,
{
id: 'remove-handler-infos',
until: '3.9.0',
url: 'https://emberjs.com/deprecations/v3.x#toc_remove-handler-infos',
}
);
return this.getRoute(name);
};
}

interface RenderOutletState {
name: string;
outlet: string;
Expand Down
4 changes: 1 addition & 3 deletions packages/@ember/deprecated-features/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ export const EMBER_EXTEND_PROTOTYPES = !!'3.2.0-beta.5';
export const RUN_SYNC = !!'3.0.0-beta.4';
export const LOGGER = !!'3.2.0-beta.1';
export const MERGE = !!'3.6.0-beta.1';
export const HANDLER_INFOS = !!'3.9.0';
export const ROUTER_EVENTS = !!'3.9.0';
export const TRANSITION_STATE = !!'3.9.0';
export const ROUTER_EVENTS = !!'4.0.0';
export const COMPONENT_MANAGER_STRING_LOOKUP = !!'3.8.0';
export const JQUERY_INTEGRATION = !!'3.9.0';
export const ALIAS_METHOD = !!'3.9.0';
Expand Down

0 comments on commit 271b5e8

Please sign in to comment.