Skip to content
Snippets Groups Projects
Commit 3b0f8b7c authored by Reiter, Christoph's avatar Reiter, Christoph :snake:
Browse files

Deprecate JSONLD.initialize()

Use "await JSONLD.getInstance()" instead
parent d1cbf63b
Branches
No related tags found
No related merge requests found
......@@ -117,7 +117,7 @@ export class AuthKeycloak extends AdapterLitElement {
const that = this;
if (newPerson && this.loadPerson) {
JSONLD.initialize(this.entryPointUrl, (jsonld) => {
JSONLD.getInstance(this.entryPointUrl).then((jsonld) => {
// find the correct api url for the current person
// we are fetching the logged-in person directly to respect the REST philosophy
// see: https://github.com/api-platform/api-platform/issues/337
......
......@@ -117,7 +117,7 @@ export class CheckInPlaceSelect extends ScopedElementsMixin(AdapterLitElement) {
initJSONLD(ignorePreset = false) {
const that = this;
JSONLD.initialize(this.entryPointUrl, function (jsonld) {
JSONLD.getInstance(this.entryPointUrl).then(function (jsonld) {
that.jsonld = jsonld;
that.active = true;
......
......@@ -20,7 +20,7 @@ export default class JSONLD {
let promise = JSONLD.promises[apiUrl];
if (promise === undefined) {
promise = new Promise((resolve, reject) => {
JSONLD.initialize(
JSONLD._initialize(
apiUrl,
(instance) => resolve(instance),
(error) => reject(error),
......@@ -33,6 +33,16 @@ export default class JSONLD {
}
static initialize(apiUrl, successFnc, failureFnc, lang = 'de') {
console.warn('DEPRECATED: JSONLD.initialize(), use JSONLD.getInstance() instead');
JSONLD._initialize(apiUrl, successFnc, failureFnc, lang);
}
static doInitializationOnce(apiUrl) {
// No longer needed, remove any calls
console.warn('DEPRECATED: JSONLD.doInitializationOnce() calls can be removed');
}
static _initialize(apiUrl, successFnc, failureFnc, lang = 'de') {
if (lang !== 'de') {
i18n.changeLanguage(lang);
}
......@@ -60,10 +70,6 @@ export default class JSONLD {
JSONLD._doInitialization(apiUrl);
}
static doInitializationOnce(apiUrl) {
// No longer needed, remove any calls
}
static _doInitialization(apiUrl) {
const xhr = new XMLHttpRequest();
xhr.open("GET", apiUrl, true);
......
......@@ -194,7 +194,7 @@ export class OrganizationSelect extends AdapterLitElement {
break;
}
case "entryPointUrl":
JSONLD.initialize(this.entryPointUrl, (jsonld) => {
JSONLD.getInstance(this.entryPointUrl).then((jsonld) => {
this.jsonld = jsonld;
}, {}, this.lang);
break;
......
......@@ -45,7 +45,7 @@ export class PersonProfile extends DBPLitElement {
case "entryPointUrl": {
const that = this;
JSONLD.initialize(this.entryPointUrl, function (jsonld) {
JSONLD.getInstance(this.entryPointUrl).then(function (jsonld) {
that.jsonld = jsonld;
}, {}, that.lang);
break;
......
......@@ -108,7 +108,7 @@ export class PersonSelect extends ScopedElementsMixin(AdapterLitElement) {
initJSONLD(ignorePreset = false) {
const that = this;
JSONLD.initialize(this.entryPointUrl, function (jsonld) {
JSONLD.getInstance(this.entryPointUrl).then(function (jsonld) {
that.jsonld = jsonld;
that.active = that.authenticated();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment