A collection of useful functions for developing Ember apps. Best served from the console.
ember-devtools is an Ember.Service
that is most useful when available in the devtools
console. The simplest was access this from the console is using
a global variable (eww!) which can be defined in config/environment.js
.
var ENV = {
'ember-devtools': {
global: true,
enabled: environment === 'development'
}
}
Setting global
will allow access to the devTools
functions globally (eg. you can
run routes()
in the console). If you'd prefer these functions to be under a prefix
set global: 'devTools'
for devTools.routes()
.
The enabled
option will enable the addon. By default, this addon will only be included in the development
environment.
Alternatively you can use Ember.inject.service('ember-devtools')
or appInstance.lookup('service:ember-devtools')
.
Returns the named application. name
defaults to main
.
Returns the names of all routes.
Returns the named route. name
defaults to the current route.
Returns the named router instance. name
defaults to main
.
Returns the model for the named controller. name
defaults to the the current route.
Performs a lookup for the named service in the owner
(using 'service:' + name
).
Returns the named controller. name
defaults to the current route.
Resolves the promise
and logs the resolved value using console.log
.
Also sets window.$E
to the resolved value so you can access it in the dev
tools console.
If property
is specified then $E.get(property)
will be logged.
If getEach
is true then $E.getEach(property)
will be logged.
> log(store.find('organisation')) => undefined
> $E.get('length') => 3
> log(store.find('organisation'), 'length') => 3
> log(store.find('organisation'), 'name', true) => array of names
Performs a lookup for the named entry in the owner
, which will in turn
ask its resolver
if it's not found.
Performs a lookup for the named factory in the registry
.
Searches the owner
to find the name for the specified object (if any).
Does what it says, in a manner of speaking. Alias to Ember.inspect
.
Switch logging for the resolver on or off.
Switch logging for all the things on/off.
Logs the rendering duration (in milliseconds) of each component, view and helper.
Attach all of these useful functions to the window
object (eww!) - useful
for accessing in the console.
The owner of the service or specified obj
.
Returns the Application config
The owner of the service. n.b. this is not globalised (to avoid conflict with window.owner
), use getOwner()
instead.
The Ember Data Store
.
The Ember Data 'type map'.
npm install ember-devtools --save-dev
ember-devtools is now dependent on ember-cli.
- v6:
container
andcontainerNameFor
are nowowner
andownerNameFor