Skip to content

Instantly share code, notes, and snippets.

@film42
Last active December 20, 2015 04:08
Show Gist options
  • Save film42/6068225 to your computer and use it in GitHub Desktop.
Save film42/6068225 to your computer and use it in GitHub Desktop.
var App = Ember.Application.create({
});
App.ThoughtsController = Ember.ArrayController.extend({
init: function () {
var that = this;
setInterval(function() {
that.set("content", App.Thought.find({hack:"hack"}));
}, 4000);
}
});
App.Thoughts = Ember.Object.extend({
messageDidChange: function () {
alert("changed!");
console.log("something");
}.observes('App.Thought.message')
});
App.Router.map(function() {
this.resource("thoughts");
});
App.IndexRoute = Ember.Route.extend({
redirect: function() {
this.transitionTo("thoughts");
}
});
App.ThoughtsRoute = Ember.Route.extend({
model: function() {
return App.Thought.find({hack:"hack"});
}
});
App.Store = DS.Store.extend({
revision: 11,
adapter: DS.RESTAdapter.extend({
url: '/sciffy/thought'
})
});
App.Thought = DS.Model.extend({
class : DS.attr("string"),
message : DS.attr("string")
});
<script type="text/x-handlebars" data-template-name="thoughts">
<blockquote class="oval-thought" style="position: relative; top: 50px; right: 50px;">
{{#each content}}
<p id="">{{message}}</p>
{{/each}}
</blockquote>
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment