Skip to content

Instantly share code, notes, and snippets.

@mattd
Created November 18, 2012 21:57
Show Gist options
  • Save mattd/4107773 to your computer and use it in GitHub Desktop.
Save mattd/4107773 to your computer and use it in GitHub Desktop.
define([
'vent',
'marionette',
'collections/widget',
'layouts/index',
'views/widget/collection'
], function (
vent,
Marionette,
WidgetCollection,
IndexLayout,
WidgetCollectionView
) {
"use strict";
return Marionette.Controller.extend({
initialize: function (options) {
this.region = options.region;
},
index: function () {
var layout = new IndexLayout();
var collection = new WidgetCollection();
this.region.show(layout);
layout.widgets.show(
new WidgetCollectionView({
collection: collection
})
);
collection.fetch();
setInterval(function () {
vent.trigger('refresh:widgets');
}, 1000);
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment