Init
This commit is contained in:
commit
508a04cf4c
30 changed files with 1545 additions and 0 deletions
37
client/src/js/actions/channel.js
Normal file
37
client/src/js/actions/channel.js
Normal file
|
@ -0,0 +1,37 @@
|
|||
var Reflux = require('reflux');
|
||||
var sock = require('../socket.js')('/ws');
|
||||
|
||||
var channelActions = Reflux.createActions([
|
||||
'join',
|
||||
'joined',
|
||||
'part',
|
||||
'parted',
|
||||
'setUsers',
|
||||
'load'
|
||||
]);
|
||||
|
||||
channelActions.join.preEmit = function(data) {
|
||||
sock.send('join', data);
|
||||
};
|
||||
|
||||
channelActions.part.preEmit = function(data) {
|
||||
sock.send('part', data);
|
||||
};
|
||||
|
||||
sock.on('join', function(data) {
|
||||
channelActions.joined(data.user, data.server, data.channels[0]);
|
||||
});
|
||||
|
||||
sock.on('part', function(data) {
|
||||
channelActions.parted(data.user, data.server, data.channels[0]);
|
||||
});
|
||||
|
||||
sock.on('users', function(data) {
|
||||
channelActions.setUsers(data.users, data.server, data.channel);
|
||||
});
|
||||
|
||||
sock.on('channels', function(data) {
|
||||
channelActions.load(data);
|
||||
});
|
||||
|
||||
module.exports = channelActions;
|
13
client/src/js/actions/message.js
Normal file
13
client/src/js/actions/message.js
Normal file
|
@ -0,0 +1,13 @@
|
|||
var Reflux = require('reflux');
|
||||
|
||||
var messageActions = Reflux.createActions([
|
||||
'send',
|
||||
'add',
|
||||
'selectTab'
|
||||
]);
|
||||
|
||||
messageActions.send.preEmit = function() {
|
||||
|
||||
};
|
||||
|
||||
module.exports = messageActions;
|
13
client/src/js/actions/server.js
Normal file
13
client/src/js/actions/server.js
Normal file
|
@ -0,0 +1,13 @@
|
|||
var Reflux = require('reflux');
|
||||
var sock = require('../socket.js')('/ws');
|
||||
|
||||
var serverActions = Reflux.createActions([
|
||||
'connect',
|
||||
'disconnect'
|
||||
]);
|
||||
|
||||
serverActions.connect.preEmit = function(data) {
|
||||
sock.send('connect', data);
|
||||
};
|
||||
|
||||
module.exports = serverActions;
|
7
client/src/js/actions/tab.js
Normal file
7
client/src/js/actions/tab.js
Normal file
|
@ -0,0 +1,7 @@
|
|||
var Reflux = require('reflux');
|
||||
|
||||
var tabActions = Reflux.createActions([
|
||||
'select'
|
||||
]);
|
||||
|
||||
module.exports = tabActions;
|
Loading…
Add table
Add a link
Reference in a new issue