fsb_backbone/app/app.js
Martin Donnelly e1d9657e87 init
2021-03-12 07:55:43 +00:00

29 lines
1.2 KiB
JavaScript

const $ = require('jquery');
const _ = require('underscore');
const Backbone = require('backbone');
const io = require('socket.io-client');
const socket = io('http://localhost:3001');
const EventItem = require('./components/EventItem');
const EventCollection = require('./components/EventCollection');
const EventListModel = require('./components/EventListModel');
const EventItemView = require('./components/EventItemView');
const EventListView = require('./components/EventListView');
socket.on('selectionPriceUpdate', data => console.log('selectionPriceUpdate', data));
socket.on('SelectionStateUpdate', data => console.log('selectionStateUpdate', data));
socket.on('eventStateUpdate', data => console.log('eventStateUpdate', data));
(function() {
console.log('Go!');
const eventCollection = new EventCollection({ 'model':EventItem });
const eventList = new EventListModel({ 'eventCollection':eventCollection });
const newsListView = new EventListView({ 'model': eventList, 'el':'#eventList' });
socket.on('selectionPriceUpdate', data => eventList.updatedItem( data));
socket.on('SelectionStateUpdate', data => eventList.updatedState( data));
socket.on('eventStateUpdate', data => eventList.updatedState( data));
})();