perspective/perspective

View on GitHub
lib/client/connection-store.js

Summary

Maintainability
A
1 hr
Test Coverage
var Fluxxor = require('fluxxor');
var _ = require('lodash');

module.exports = Fluxxor.createStore({
  initialize: function(socket) {
    this.connected = false;
    this.websocket = socket;

    socket.on('connect', function() {
      this.connected = true;
      this.emit('change');
    }.bind(this));

    socket.on('disconnect', function() {
      this.connected = false;
      this.emit('change');
    }.bind(this));
  }
});