Publish Vulpes Preview 15 sources for desktop, Android and Tundra
Share Gaia assets and adapters, keep private profiles and development documents local, and update both public READMEs.
This commit is contained in:
parent
93e3a48004
commit
b38dea0597
25901 changed files with 9982925 additions and 369 deletions
27
gaia/apps/calendar/js/backend/provider/factory.js
Executable file
27
gaia/apps/calendar/js/backend/provider/factory.js
Executable file
|
|
@ -0,0 +1,27 @@
|
|||
define(function(require, exports) {
|
||||
'use strict';
|
||||
|
||||
var debug = require('common/debug')('provider/factory');
|
||||
|
||||
var ctors = {
|
||||
Caldav: require('./caldav'),
|
||||
Local: require('./local')
|
||||
};
|
||||
|
||||
var providers = exports.providers = Object.create(null);
|
||||
|
||||
exports.get = function(name) {
|
||||
if (!providers[name]) {
|
||||
try {
|
||||
debug(`Initializing provider ${name}`);
|
||||
providers[name] = new ctors[name]();
|
||||
} catch (e) {
|
||||
console.error('Error', e.name, e.message);
|
||||
console.error('Failed to initialize provider', name, e.stack);
|
||||
}
|
||||
}
|
||||
|
||||
return providers[name];
|
||||
};
|
||||
|
||||
});
|
||||
Loading…
Reference in a new issue