Esempio n. 1
0
var EVENT_EMITTER       = require(__dirname + '/../events.js');

var GlobalEventEmitter = EVENT_EMITTER.getEventEmitter();

// export function for listening to the socket
module.exports = function(socket) {
	console.log('Connected');	  

	socket.on('test', function(msg){
		console.log('message: ' + msg);
		socket.emit('reply', 'got your message:' + msg);
	});

	socket.on('disconnect', function () {
		console.log('Disconnected');
	});

	GlobalEventEmitter.on('usercreated', function(data) {
		socket.emit('usercreated', data);
	});

	GlobalEventEmitter.on('userupdated', function(data) {
		socket.emit('userupdated', data);
	});

	GlobalEventEmitter.on('userdeleted', function(data) {
		socket.emit('userdeleted', data);
	});
};
 * note-related modules such as the notes, note editor and events.
 *
 * @author : Abijeet Patro
 ****************************************************************/

'use strict';
var _i18n = require('i18n');
var _marked = require('mark-it-down');

var _appConfig = require(__dirname + '/../../../config.js');
var _notes = require(_appConfig.browserSrcPath + 'notes/note.js');
var _noteEvents = require(_appConfig.browserSrcPath + 'notes/note-events.js');
var _noteEditor = require(_appConfig.browserSrcPath + 'notes/note-editor.js');
var _appError = require(_appConfig.commonsPath + 'app-error.js');
var _appUtil = require(_appConfig.commonsPath + 'utility.js');
var _ee = _appConfig.getEventEmitter();

var NoteClient = function() {
  var currentlyFocusedNote = null;

  function _init() {
    // Initialize note events with callback events.
    _noteEvents.init({
      saveNote: saveNote,
      markNoteAsComplete: markNoteAsComplete,
      saveAndCreateNote: saveAndCreateNote,
      deleteNote: deleteNote,
      makeNoteEditable: makeNoteEditable,
      displayNoteDateDlg: displayNoteDateDlg,
      modifyNoteDate: modifyNoteDate
    });