flowthings/websocketFactory.js
function crudable(flowthingsWs) {
  return {
    create: function(obj, params, responseHandler, cb) {
      if (typeof params === 'function') {
        cb = responseHandler; responseHandler = params; params = {};
      } else if (!params) {
        params = {};
      }

      baseWs(flowthingsWs, this.objectType, 'create', {value: obj},
             {msgId: params.msgId, responseHandler: responseHandler, cb: cb});
    },

    read: function(id, params, responseHandler, cb) {
      if (typeof params === 'function') {
        cb = responseHandler; responseHandler = params; params = {};
      } else if (!params) {
        params = {};
      }

      id = fixDropId(id, this);

      baseWs(flowthingsWs, this.objectType, 'find', {id: id},
             {msgId: params.msgId, responseHandler: responseHandler, cb: cb});
    },

    update: function(id, obj, params, responseHandler, cb) {
      if (typeof params === 'function') {
        cb = responseHandler; responseHandler = params; params = {};
      } else if (!params) {
        params = {};
      }

      id = fixDropId(id, this);

      baseWs(flowthingsWs, this.objectType, 'update', {id: id, value: obj},
             {msgId: params.msgId, responseHandler: responseHandler, cb: cb});
    },

    delete: function(id, params, responseHandler, cb) {
      if (typeof params === 'function') {
        cb = responseHandler; responseHandler = params; params = {};
      } else if (!params) {
        params = {};
      }

      id = fixDropId(id, this);

      baseWs(flowthingsWs, this.objectType, this.objectType, 'delete', {id: id},
             {msgId: params.msgId, responseHandler: responseHandler, cb: cb});
    }
  };
}
function crudable(flowthingsWs) {
  return {
    create: function(obj, params, responseHandler, cb) {
      if (typeof params === 'function') {
        cb = responseHandler; responseHandler = params; params = {};
      } else if (!params) {
        params = {};
      }

      baseWs(flowthingsWs, this.objectType, 'create', {value: obj},
             {msgId: params.msgId, responseHandler: responseHandler, cb: cb});
    },

    read: function(id, params, responseHandler, cb) {
      if (typeof params === 'function') {
        cb = responseHandler; responseHandler = params; params = {};
      } else if (!params) {
        params = {};
      }

      id = fixDropId(id, this);

      baseWs(flowthingsWs, this.objectType, 'find', {id: id},
             {msgId: params.msgId, responseHandler: responseHandler, cb: cb});
    },

    update: function(id, obj, params, responseHandler, cb) {
      if (typeof params === 'function') {
        cb = responseHandler; responseHandler = params; params = {};
      } else if (!params) {
        params = {};
      }

      id = fixDropId(id, this);

      baseWs(flowthingsWs, this.objectType, 'update', {id: id, value: obj},
             {msgId: params.msgId, responseHandler: responseHandler, cb: cb});
    },

    delete: function(id, params, responseHandler, cb) {
      if (typeof params === 'function') {
        cb = responseHandler; responseHandler = params; params = {};
      } else if (!params) {
        params = {};
      }

      id = fixDropId(id, this);

      baseWs(flowthingsWs, this.objectType, this.objectType, 'delete', {id: id},
             {msgId: params.msgId, responseHandler: responseHandler, cb: cb});
    }
  };
}
function crudable ( flowthingsWs ) { return { create : function ( obj , params , responseHandler , cb ) { if ( typeof params === 'function' ) { cb = responseHandler ; responseHandler = params ; params = { } ; } else if ( ! params ) { params = { } ; } baseWs ( flowthingsWs , this . objectType , 'create' , { value : obj } , { msgId : params . msgId , responseHandler : responseHandler , cb : cb } ) ; } , read : function ( id , params , responseHandler , cb ) { if ( typeof params === 'function' ) { cb = responseHandler ; responseHandler = params ; params = { } ; } else if ( ! params ) { params = { } ; } id = fixDropId ( id , this ) ; baseWs ( flowthingsWs , this . objectType , 'find' , { id : id } , { msgId : params . msgId , responseHandler : responseHandler , cb : cb } ) ; } , update : function ( id , obj , params , responseHandler , cb ) { if ( typeof params === 'function' ) { cb = responseHandler ; responseHandler = params ; params = { } ; } else if ( ! params ) { params = { } ; } id = fixDropId ( id , this ) ; baseWs ( flowthingsWs , this . objectType , 'update' , { id : id , value : obj } , { msgId : params . msgId , responseHandler : responseHandler , cb : cb } ) ; } , delete : function ( id , params , responseHandler , cb ) { if ( typeof params === 'function' ) { cb = responseHandler ; responseHandler = params ; params = { } ; } else if ( ! params ) { params = { } ; } id = fixDropId ( id , this ) ; baseWs ( flowthingsWs , this . objectType , this . objectType , 'delete' , { id : id } , { msgId : params . msgId , responseHandler : responseHandler , cb : cb } ) ; } } ; }
These are in the private API. We don't really want people to access them directly.
These are in the private API . We don t really want people to access them directly .