Skip to content

Commit

Permalink
Fixed race condition.
Browse files Browse the repository at this point in the history
  • Loading branch information
Julian Connor committed Nov 21, 2011
1 parent cc2c1ed commit 34567f2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion app/views/layouts/application.html.erb
Expand Up @@ -9,7 +9,6 @@
<%= javascript_include_tag "jquery.jplayer.min.js" %>
<%= javascript_include_tag "underscore.js" %>
<%= javascript_include_tag "backbone.js" %>
<%= javascript_include_tag "myvolume.js" %>
<%= csrf_meta_tag %>
<!-- Google Analytics -->
Expand Down Expand Up @@ -87,6 +86,7 @@
</div>
</div>
<% end %>
<%= javascript_include_tag "myvolume.js" %>

</body>
</html>
Expand Down
16 changes: 8 additions & 8 deletions public/javascripts/myvolume.js
@@ -1,6 +1,6 @@
(function($) {

window.ChartModel = Backbone.Model.extend({
var ChartModel = Backbone.Model.extend({

defaults: function() {
return {
Expand All @@ -18,7 +18,7 @@

});

window.ChartList = Backbone.Collection.extend({
var ChartList = Backbone.Collection.extend({

model: ChartModel,
url: "/charts"
Expand All @@ -27,13 +27,13 @@

window.Charts = new ChartList;

window.ChartsView = Backbone.View.extend({
//template: _.template($("chart-template").html()),
var ChartsView = Backbone.View.extend({
el: $("#charts"),

initialize: function() {
console.log("ChartsView::Init");
_.bindAll(this, "render", "addOne", "addAll");

Charts.bind("reset", this.addAll, this);
Charts.fetch();

Expand All @@ -42,7 +42,7 @@

render: function() {
console.log("ChartsView::Render");
console.log(this);
console.log(this.el);
$(this.el).html("<div class='chart_list'></div>");
return this;
},
Expand All @@ -60,7 +60,7 @@

});

window.ChartItemView = Backbone.View.extend({
var ChartItemView = Backbone.View.extend({
initialize: function() {
console.log("ChartItemView::Init");
_.bindAll(this, 'render');
Expand All @@ -79,8 +79,8 @@
el: $("body"),

initialize: function() {
console.log("AppView yay");
var view = new ChartsView();
console.log("AppView::Init");
window._ChartsView = new ChartsView;
}
});

Expand Down

0 comments on commit 34567f2

Please sign in to comment.