Commit f6015801 authored by Sven Franck's avatar Sven Franck

jslint pass jioNamespace.js

parent 598490f5
/*jslint indent: 2, maxlen: 80, sloppy: true */
/*global jio: true, invalidStorageType: true */
var storage_type_object = { // -> 'key':constructorFunction
'base': function () {} // overriden by jio
};
var jioNamespace = (function(spec) {
var jioNamespace = (function (spec) {
var that = {};
spec = spec || {};
// Attributes //
......@@ -18,14 +20,19 @@ var jioNamespace = (function(spec) {
* - {string} spec.storage.application_name: The application name
* @return {object} The new Jio instance.
*/
Object.defineProperty(that,"newJio",{
configurable:false,enumerable:false,writable:false,value:
function(spec) {
var storage = spec, instance = null;
Object.defineProperty(that, "newJio", {
configurable: false,
enumerable: false,
writable: false,
value: function (spec) {
var storage = spec,
instance = null;
if (typeof storage === 'string') {
storage = JSON.parse (storage);
storage = JSON.parse(storage);
}
storage = storage || {type:'base'};
storage = storage || {
type: 'base'
};
instance = jio(spec);
instance.start();
return instance;
......@@ -38,12 +45,19 @@ var jioNamespace = (function(spec) {
* @param {string} type The storage type
* @param {function} constructor The associated constructor
*/
Object.defineProperty(that,"addStorageType",{
configurable:false,enumerable:false,writable:false,value:
function(type, constructor) {
constructor = constructor || function(){return null;};
Object.defineProperty(that, "addStorageType", {
configurable: false,
enumerable: false,
writable: false,
value: function (type, constructor) {
constructor = constructor || function () {
return null;
};
if (storage_type_object[type]) {
throw invalidStorageType({type:type,message:'Already known.'});
throw invalidStorageType({
type: type,
message: 'Already known.'
});
}
storage_type_object[type] = constructor;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment