Created
June 27, 2013 14:55
-
-
Save Psvensso/5877108 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Debugging EmberJS and EmberData: | |
Log router transitions: | |
window.App = Ember.Application.create({ | |
LOG_TRANSITIONS: true, | |
}); | |
Log object bindings: | |
Ember.LOG_BINDINGS = true | |
View all registered routes | |
Ember.keys(App.Router.router.recognizer.names) | |
View all registered templates | |
Ember.keys(Ember.TEMPLATES) | |
View the state history of an ember-data record: | |
record.stateManager.get('currentPath') | |
View an instance of something from the container | |
App.__container__.lookup("controller:posts") | |
App.__container__.lookup("route:application") | |
View ember-data's identity map: | |
App.__container__.lookup('store:main').recordCache # all records in memory | |
App.__container__.lookup('store:main').recordCache[2].get('data.attributes') #attributes | |
App.__container__.lookup('store:main').recordCache[2].get('comments') #loaded associations | |
See all observers for a object, key: | |
Ember.observersFor(comments, keyName); | |
Dealing with deprecations: | |
Ember.ENV.RAISE_ON_DEPRECATION = true | |
Ember.LOG_STACKTRACE_ON_DEPRECATION = true | |
Handlebars | |
{{debugger}} | |
{{log record}} | |
Implement a Ember.onerror hook to log all errors in production: | |
Ember.onerror = function(error) { | |
Em.$.ajax('/error-notification', 'POST', { | |
stack: error.stack, | |
otherInformation: 'exception message' | |
}); | |
}; | |
Use ember extension when its ready. | |
https://github.com/tildeio/ember-extension.git |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment