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
import Ember from 'ember'; | |
export default Ember.Component.extend({ | |
foo: 'ha', | |
bar: 'ho', | |
baz: Ember.on('init', function () { | |
debugger | |
console.log(this.get('foo')) | |
console.log(Object.keys(this)) |
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
click (event) { | |
// Acceptable event modifiers for range selection | |
const isSimpleClick = Ember.ViewUtils.isSimpleClick(event) | |
const isSpecificSelect = (new window.UAParser()).getOS() === 'Mac OS' ? event.ctrlKey : event.metaKey // TODO Move instance to a service | |
const isRangeSelect = event.shiftKey | |
// Only process simple clicks or clicks with the acceptable modifiers | |
if (isSimpleClick || isSpecificSelect || isRangeSelect) { | |
event.preventDefault() | |
event.stopPropagation() |
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
this.set('selectedItems', []) // TODO prefix | |
this.set('previousRangeEndItemIndex', null) // TODO prefix | |
this.set('rangeAnchorIndex', null) // TODO prefix | |
this.set('actions.select', function ({isCheckboxSelect, isRangeSelect, isCurrentlySelected, isSpecificSelect, item}) { | |
const selectedItems = this.get('selectedItems') | |
// Selects are proccessed in order of precedence: checkbox, specific, range, default | |
if (isCheckboxSelect) { | |
// Checkbox select works like a specific select, the target item |
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
import Ember from 'ember'; | |
export default Ember.Component.extend({ | |
attributeBindings: ['x', 'y','width', 'height', 'data-tabindex'], | |
tagName: 'rect', | |
'data-tabindex': '0' | |
}); |
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
import BaseSvg from './base-svg'; | |
export default BaseSvg.extend({ | |
tagName: 'rect', | |
fill: Ember.computed.readOnly('layerModel.color') | |
}); |
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
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
appName: 'Ember Twiddle', | |
actions: { | |
foo() { | |
const foo = undefined | |
Ember.get(foo, 'x.y') | |
foo.get('x.y') |
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
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
appName: 'Ember Twiddle', | |
myService: Ember.inject.service('my-service'), | |
actions: { | |
foo() { | |
alert(this.get('myService.test')) | |
} |
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
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
session: Ember.inject.service('my-service'), | |
foo: Ember.computed(function() { | |
return Ember.get(this.get('session').getSessionParams(), 'foo') | |
}) | |
}); |
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
import Ember from 'ember'; | |
export default Ember.Component.extend({ | |
}); |
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
import Ember from 'ember' | |
export default Ember.Component.extend({ | |
one: null, | |
two: null, | |
red: null, | |
blue: null | |
}) |