Commit f6015801 authored by Sven Franck's avatar Sven Franck

jslint pass jioNamespace.js

parent 598490f5
var storage_type_object = { // -> 'key':constructorFunction /*jslint indent: 2, maxlen: 80, sloppy: true */
'base': function () {} // overriden by jio /*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 = {}; var that = {};
spec = spec || {}; spec = spec || {};
// Attributes // // Attributes //
// Methods // // Methods //
/** /**
* Creates a new jio instance. * Creates a new jio instance.
* @method newJio * @method newJio
* @param {object} spec The parameters: * @param {object} spec The parameters:
* - {object} spec.storage: A storage description * - {object} spec.storage: A storage description
* - {string} spec.storage.type: The storage type * - {string} spec.storage.type: The storage type
* - {string} spec.storage.username: The user name * - {string} spec.storage.username: The user name
* - {string} spec.storage.application_name: The application name * - {string} spec.storage.application_name: The application name
* @return {object} The new Jio instance. * @return {object} The new Jio instance.
*/ */
Object.defineProperty(that,"newJio",{ Object.defineProperty(that, "newJio", {
configurable:false,enumerable:false,writable:false,value: configurable: false,
function(spec) { enumerable: false,
var storage = spec, instance = null; writable: false,
if (typeof storage === 'string') { value: function (spec) {
storage = JSON.parse (storage); var storage = spec,
} instance = null;
storage = storage || {type:'base'}; if (typeof storage === 'string') {
instance = jio(spec); storage = JSON.parse(storage);
instance.start(); }
return instance; storage = storage || {
} type: 'base'
}); };
instance = jio(spec);
instance.start();
return instance;
}
});
/** /**
* Add a storage type to jio. * Add a storage type to jio.
* @method addStorageType * @method addStorageType
* @param {string} type The storage type * @param {string} type The storage type
* @param {function} constructor The associated constructor * @param {function} constructor The associated constructor
*/ */
Object.defineProperty(that,"addStorageType",{ Object.defineProperty(that, "addStorageType", {
configurable:false,enumerable:false,writable:false,value: configurable: false,
function(type, constructor) { enumerable: false,
constructor = constructor || function(){return null;}; writable: false,
if (storage_type_object[type]) { value: function (type, constructor) {
throw invalidStorageType({type:type,message:'Already known.'}); constructor = constructor || function () {
} return null;
storage_type_object[type] = constructor; };
} if (storage_type_object[type]) {
}); throw invalidStorageType({
type: type,
message: 'Already known.'
});
}
storage_type_object[type] = constructor;
}
});
return that; return that;
}()); }());
\ No newline at end of file
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