show names of loaded projects on the client

This commit is contained in:
oleg 2015-04-13 01:56:47 +03:00
parent 21941d4ca9
commit 637ad82f5c
3 changed files with 11 additions and 3 deletions

View File

@ -1,15 +1,20 @@
'use strict';
define([
'react', 'socketio', 'dataio'
'underscore', 'react', 'socketio', 'dataio'
], function(
React, socketio, dataio
_, React, socketio, dataio
) {
var contentEl = window.document.getElementById('content');
// console.log(React, socketio, dataio);
var connect = dataio(socketio.connect());
var projects = connect.resource('projects');
projects.sync('read', function(err, projects) {
console.log('>>> err, projects = ', err, projects)
contentEl.innerHTML = (
(err && err.message) ||
('Loaded projects: ' + _(projects).pluck('name').join(', '))
);
});
});

View File

@ -3,6 +3,7 @@
require.config({
baseUrl: '/js/',
paths: {
underscore: 'libs/underscore/underscore',
react: 'libs/react/react-with-addons',
dataio: '/data.io',
socketio: '/socket.io/socket.io.js'

View File

@ -8,3 +8,5 @@ html
body
h1 hello world
#content