Skip to content

Commit

Permalink
v1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
timbrandin committed Apr 2, 2018
1 parent e9e8496 commit 23089d5
Show file tree
Hide file tree
Showing 3 changed files with 4,026 additions and 11 deletions.
22 changes: 12 additions & 10 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,17 @@ function ajax(url, callback, data) {
}
};

function getDefaults() {
return {
loadPath: 'https://api.locize.io/{{projectId}}/{{version}}/{{lng}}/{{ns}}',
getLanguagesPath: 'https://api.locize.io/languages/{{projectId}}',
addPath: 'https://api.locize.io/missing/{{projectId}}/{{version}}/{{lng}}/{{ns}}',
referenceLng: 'en',
version: 'latest',
reloadInterval: 60 * 60 * 1000
};
function getDefaults(serviceUrl) {
if (serviceUrl) {
return {
loadPath: serviceUrl + '/{{projectId}}/{{version}}/{{lng}}/{{ns}}',
getLanguagesPath: serviceUrl + '/languages/{{projectId}}',
addPath: serviceUrl + '/missing/{{projectId}}/{{version}}/{{lng}}/{{ns}}',
referenceLng: 'en',
version: 'latest',
reloadInterval: 60 * 60 * 1000
};
}
}

var Backend = function () {
Expand All @@ -70,7 +72,7 @@ var Backend = function () {
var allOptions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};

this.services = services;
this.options = _extends({}, getDefaults(), this.options, options);
this.options = _extends({}, getDefaults(options.service), this.options, options);
this.allOptions = allOptions;

this.queuedWrites = { pending: {} };
Expand Down
Loading

0 comments on commit 23089d5

Please sign in to comment.