Added code to the admin part of the site - still non-functional. Need to fix JSON streaming over HTTP such that native types (boolean, Date, int) are preserved for the DB; Need to finish the restore functionality & the hide/show of the edit, delete, and restore buttons on each editor page.
31 lines
845 B
JavaScript
31 lines
845 B
JavaScript
//Client side brainstorm.
|
|
|
|
var Brainstorm;
|
|
|
|
+function($) {
|
|
Brainstorm = function(options) {
|
|
var _this = this;
|
|
this.options = $.extend({}, Brainstorm.DEFAULTS, options);
|
|
this.socket = io.connect(options.url);
|
|
|
|
this.socket.on('name', function(data) {
|
|
|
|
});
|
|
};
|
|
|
|
Brainstorm.DEFAULTS = {
|
|
url: '' //The url to make a websocket connection to.
|
|
};
|
|
|
|
/**
|
|
* Queries the database on the server for a set of objects of the given class that match the params provided.
|
|
* @param cls The required model class name.
|
|
* @param params The optional object containing the parameters to the query.
|
|
* @param fn The function called with the results.
|
|
*/
|
|
Brainstorm.prototype.query = function(cls, params) {
|
|
return new Promise(function(resolve, reject) {
|
|
this.socket.emit("query", {class: cls, params: params}, resolve);
|
|
});
|
|
};
|
|
}(jquery); |