Skip to content

Instantly share code, notes, and snippets.

@teddyzeenny
teddyzeenny / controllers.application\.js
Last active October 20, 2020 20:47
Bug dependentKeyCompat
import Controller from '@ember/controller';
import { tracked } from '@glimmer/tracking';
import { dependentKeyCompat } from '@ember/object/compat';
import { computed, action } from '@ember/object';
class MyClass {
@tracked
count = 0;
@dependentKeyCompat
@teddyzeenny
teddyzeenny / components.my-component.js
Created August 28, 2016 13:24
"willRender" doesn't fire when you expect it to
import Ember from 'ember';
export default Ember.Component.extend({
});
@teddyzeenny
teddyzeenny / controllers.application.js
Created August 23, 2016 18:24
Compare render controllers
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
@teddyzeenny
teddyzeenny / inspector-plan.md
Created August 4, 2015 12:53
Ember Inspector Plan
  • Move view tree logic to Ember core (Finalize #11218)
  • Fix 1.13.x and 2.0.0 beta caused regressions in the inspector
  • Go over all recent issues created in ember-inspector repo and fix the bugs.
  • Release Ember Inspector 1.8.4
  • Upgrade to Ember 1.12 (1.13 is not possible due to list-view)
  • Add a new Ember Data serializer pane
  • Updates to the deprecations pane:
    • Add option to raise on specific deprecations
    • Handle deprecation "urgency"
  • Persist deprecations across app resets (for example during tests)
@teddyzeenny
teddyzeenny / gist:36f88c82545249816fbf
Last active August 29, 2015 14:21
New method syntax
// Use:
export default Route.extend({
beforeModel() {
},
model() {
},
afterModel() {
@teddyzeenny
teddyzeenny / gist:49459a483f4f690b5bed
Created May 23, 2015 16:55
Ember Inspector Portability

How Ember Inspector handles portability

Ember Inspector started as a Chrome-only extension, and then evolved into a browser agnostic addon. It is currently an ember-cli app that supports all browsers, even ones that don't have addons/devtools support.

Below is how we were able to achieve portability. Some points below may prove helpful in designing the new framework.

Adapters

Even though both Chrome and Firefox support using HTML, CSS, and Javascript to build addons, when it comes to addon/devtools-specific API, they have completely different implementations. That's where adapters come in. All browser specific methods are extracted into the adapter layer to keep the actual code browser agnostic.

@teddyzeenny
teddyzeenny / gist:0a1768b567b3ce3a2978
Last active August 29, 2015 14:20
Ember Inspector - Glimmer issues
  • _childViews is gone - Use childViews instead? childViews will skip virtual views which may not exist anymore anyway? see point 2.
  • Virtual views don't seem to get a view instance anymore - How to catch them using the inspector - is there a template tree? See http://emberjs.jsbin.com/wifete/3/edit. Also is that a breaking change? Even virtual route views don't get a view instance anymore, which means all view.{propertyName} are not accessible in the template anymore (example view.controller.name). Another example: Ember.View.reopen({company: 'Google'}); {{view.company}}
  • childViews doesn't change, and old views aren't being destroyed. See http://emberjs.jsbin.com/lelodu/2/edit
  • Route views used to have a _debugTemplateName - which is null now.
var SocketService = Ember.Object.extend({
socket: null,
connect: function() {
// code to connect and set the socket
}
});
App.initializer({
name: 'socket',
@teddyzeenny
teddyzeenny / gist:9996330
Created April 5, 2014 18:58
Log manager array appender
function ArrayAppender() {
this.logArray = [];
};
Appender.prototype.log = function(name, level, message) {
this.logArray.push({
name: name,
level: level,
message: message
describe("reports", function () {
before(function() {
Ember.run(Social, Social.advanceReadiness);
});
afterEach(function() {
Social.reset();
});