Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fredguth/6c3ef8a55c81fb4704c57f31f722b7ba to your computer and use it in GitHub Desktop.
Save fredguth/6c3ef8a55c81fb4704c57f31f722b7ba to your computer and use it in GitHub Desktop.
Arbitrary properties set via an object hash
import Ember from 'ember';
export default Ember.Component.extend({
notMyInput: Ember.computed('myInput', function() {
return !this.get('myInput')
})
});
import Ember from 'ember';
import fabric from 'fabric';
export default Ember.Controller.extend({
parentInput: true,
didInsertElement() {
let canvas = new fabric.Canvas('pad', {
isDrawingMode: false
});
var redRect = new fabric.Rect({
width: w,
height: h,
fill: 'red',
top: 15,
left: 50
});
var blueRect = new fabric.Rect({
width: 20,
height: 30,
fill: 'blue',
top: 15,
left: 50 + w - 10
});
canvas.add(redRect);
canvas.add(blueRect);
this.set('canvas', canvas);
},
actions: {
changeInput() {
this.set(
'parentInput',!this.get('parentInput')
)
},
onObjectDblClick(event) {
}
}
});
<div {{action "changeInput"}}>ParentInput:{{parentInput}}</div>
{{my-component
myInput=parentInput
}}
<canvas id="pad" width="300" height="200">
</canvas>
<div style="color:red">myInput:{{myInput}}</div><div style="color:red">notMyInput:{{notMyInput}}</div>
import Ember from 'ember';
export default function destroyApp(application) {
Ember.run(application, 'destroy');
}
import Resolver from '../../resolver';
import config from '../../config/environment';
const resolver = Resolver.create();
resolver.namespace = {
modulePrefix: config.modulePrefix,
podModulePrefix: config.podModulePrefix
};
export default resolver;
import Ember from 'ember';
import Application from '../../app';
import config from '../../config/environment';
const { run } = Ember;
const assign = Ember.assign || Ember.merge;
export default function startApp(attrs) {
let application;
let attributes = assign({rootElement: "#test-root"}, config.APP);
attributes = assign(attributes, attrs); // use defaults, but you can override;
run(() => {
application = Application.create(attributes);
application.setupForTesting();
application.injectTestHelpers();
});
return application;
}
import resolver from './helpers/resolver';
import {
setResolver
} from 'ember-qunit';
setResolver(resolver);
{
"version": "0.10.4",
"EmberENV": {
"FEATURES": {}
},
"options": {
"use_pods": false,
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js",
"ember": "2.7.0",
"ember-data": "2.7.0",
"ember-template-compiler": "2.7.0"
},
"addons": {
"ember-cli-fabric2-shim": "^0.2.0"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment