Skip to content

Instantly share code, notes, and snippets.

View Serabe's full-sized avatar

Sergio Arbeo Serabe

View GitHub Profile
import Ember from 'ember';
export default Ember.Component.extend({
classNames: ['red'],
didInsertElement() {
window.nested = this;
}
});
import Ember from 'ember';
export default Ember.Component.extend({
click(evt) {
alert(`has stop propagation? ${'stopPropagation' in evt ? 'Yes' : 'No'}`);
}
});
@Serabe
Serabe / promises2.js
Last active October 26, 2018 17:17
Custom impl for Promise.all and Promise.race
const callOnlyOnce = (fn) => {
let called = false;
return function() {
if (called) {
return;
}
called = true;
return fn.apply(this, arguments);
}
}
import Ember from 'ember';
export default Ember.Component.extend({
tagName: 'span',
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
foos: ['hello', 'goodbye', 'maybe'],
bar: 'maybe'
});
@Serabe
Serabe / components.my-component.js
Created September 28, 2018 17:02
Not local lookup
import Ember from 'ember';
export default Ember.Component.extend({
});
@Serabe
Serabe / controllers.application.js
Last active July 25, 2018 14:17
setup controller not being called
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
arr: Ember.A([]),
theLength: Ember.computed('arr[]', function() {
return this.get('arr').length;
}),
@Serabe
Serabe / components.my-component.js
Created March 23, 2018 00:01
Concatenated properties in contextual components
import Ember from 'ember';
export default Ember.Component.extend({
classNames: ['green-border']
});