Created
December 27, 2015 21:48
-
-
Save rwjblue/33a74f57571d46b56b04 to your computer and use it in GitHub Desktop.
New Twiddle
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'; | |
import log from '../utils/log'; | |
import Post from '../models/post'; | |
export default Ember.Route.extend({ | |
model() { | |
return new Post({ | |
title: 'So Classy!', | |
author: 'Robert' | |
}); | |
}, | |
actions: { | |
error: function(error) { | |
log(error.message); | |
} | |
} | |
}); |
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
export default class Post { | |
constructor(options) { | |
for (let key in options) { | |
this[key] = options[key]; | |
} | |
} | |
} |
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
{ | |
"version": "0.4.13", | |
"dependencies": { | |
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js", | |
"ember": "canary", | |
"ember-template-compiler": "canary" | |
} | |
} |
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'; | |
Ember.onerror = function(error) { | |
log(error.stack); | |
}; | |
export default function log(...args) { | |
let msg = args.join(' '); | |
let logs = document.getElementById('logs'); | |
if (!logs) { | |
logs = document.createElement('pre'); | |
document.body.appendChild(logs); | |
} | |
logs.insertBefore( | |
document.createTextNode("\n" + msg), | |
logs.firstChild | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment