c8osdkvuejs
Advanced tools
Comparing version 0.0.0-beta8 to 0.0.0-beta9
{ | ||
"name": "c8osdkvuejs", | ||
"version": "0.0.0-beta8", | ||
"version": "0.0.0-beta9", | ||
"description": "convertigo's MBaaS client API service", | ||
@@ -5,0 +5,0 @@ "main": "bundle/index.umd.js", |
@@ -5,4 +5,5 @@ import { C8oCore, C8oSettings } from "c8osdkjscore"; | ||
readonly sdkVersion: string; | ||
newdef(): void; | ||
init(c8oSettings?: C8oSettings): Promise<any>; | ||
finalizeInit(): Promise<any>; | ||
} |
@@ -24,2 +24,5 @@ "use strict"; | ||
_this.c8oLogger = new c8osdkjscore_1.C8oLogger(_this, true); | ||
if (global["window"] === undefined) { | ||
global["window"] = {}; | ||
} | ||
return _this; | ||
@@ -34,85 +37,95 @@ } | ||
}); | ||
C8o.prototype.newdef = function () { | ||
console.log('jajjaj'); | ||
document.addEventListener("DOMContentLoaded", function () { | ||
if (window) { | ||
window.console.log("dans l'event"); | ||
window.alert("dans l'event"); | ||
} | ||
}); | ||
}; | ||
C8o.prototype.init = function (c8oSettings) { | ||
var _this = this; | ||
if (process["browser"]) { | ||
var nullableEndpoint = true; | ||
if (c8oSettings !== undefined) { | ||
if (c8oSettings.endpoint != null) { | ||
nullableEndpoint = false; | ||
document.addEventListener("DOMContentLoaded", function () { | ||
return null; | ||
}); | ||
var nullableEndpoint = true; | ||
if (c8oSettings !== undefined) { | ||
if (c8oSettings.endpoint != null) { | ||
nullableEndpoint = false; | ||
} | ||
} | ||
if (nullableEndpoint) { | ||
this.promiseConstructor = new Promise(function (resolve) { | ||
if (window.location.href.startsWith("http") && window.location.href.indexOf("/DisplayObjects") != -1) { | ||
var n = window.location.href.indexOf("/DisplayObjects"); | ||
_this.endpoint = window.location.href.substring(0, n); | ||
resolve(); | ||
} | ||
} | ||
if (nullableEndpoint) { | ||
this.promiseConstructor = new Promise(function (resolve) { | ||
if (window.location.href.startsWith("http") && window.location.href.indexOf("/DisplayObjects") != -1) { | ||
var n = window.location.href.indexOf("/DisplayObjects"); | ||
_this.endpoint = window.location.href.substring(0, n); | ||
resolve(); | ||
else { | ||
var uri = ""; | ||
if (window.location.href.startsWith("file://")) { | ||
uri = (window.location.href.substring(0, window.location.href.indexOf("/index.html"))) + "/env.json"; | ||
} | ||
else { | ||
var uri = ""; | ||
if (window.location.href.startsWith("file://")) { | ||
uri = (window.location.href.substring(0, window.location.href.indexOf("/index.html"))) + "/env.json"; | ||
uri = window.location.origin + "/env.json"; | ||
} | ||
_this.httpPublic.get(uri) | ||
.then(function (data) { | ||
_this.data = data; | ||
var remoteBase = data["remoteBase"].toString(); | ||
var n = remoteBase.indexOf("/_private"); | ||
_this.endpoint = remoteBase.substring(0, n); | ||
_this._automaticRemoveSplashsCreen = data["splashScreenRemoveMode"] !== "manual"; | ||
resolve(); | ||
}).catch(function (error) { | ||
alert("Missing env.json file"); | ||
var errMsg; | ||
if (error instanceof Error) { | ||
errMsg = error.message; | ||
} | ||
else { | ||
uri = window.location.origin + "/env.json"; | ||
errMsg = error.status + " - " + (error.statusText || "") + " " + error; | ||
} | ||
_this.httpPublic.get(uri) | ||
.then(function (data) { | ||
_this.data = data; | ||
var remoteBase = data["remoteBase"].toString(); | ||
var n = remoteBase.indexOf("/_private"); | ||
_this.endpoint = remoteBase.substring(0, n); | ||
_this._automaticRemoveSplashsCreen = data["splashScreenRemoveMode"] !== "manual"; | ||
resolve(); | ||
}).catch(function (error) { | ||
alert("Missing env.json file"); | ||
var errMsg; | ||
if (error instanceof Error) { | ||
errMsg = error.message; | ||
} | ||
else { | ||
errMsg = error.status + " - " + (error.statusText || "") + " " + error; | ||
} | ||
return Observable_1.Observable.throw(errMsg); | ||
}); | ||
return Observable_1.Observable.throw(errMsg); | ||
}); | ||
} | ||
}).then(function () { | ||
_this.extractendpoint(); | ||
}); | ||
} | ||
else { | ||
this.promiseConstructor = new Promise(function (resolve) { | ||
_this.endpoint = c8oSettings.endpoint; | ||
_this.extractendpoint(); | ||
resolve(); | ||
}); | ||
} | ||
this.promiseInit = Promise.all([this.promiseConstructor]).then(function () { | ||
return new Promise(function (resolve) { | ||
_this.copy(c8oSettings); | ||
_this.httpInterface = new c8oHttpInterface_service_1.C8oHttpInterface(_this); | ||
_this.c8oLogger.affect_val(_this, false); | ||
_this.c8oLogger.logRemoteInit(); | ||
document.addEventListener("offline", function () { | ||
_this.c8oLogger.info("Network offline"); | ||
_this.c8oLogger.info("Setting remote logs to false"); | ||
_this.logRemote = false; | ||
if (_this.logOnFail != null) { | ||
_this.logOnFail(new c8osdkjscore_1.C8oException(c8osdkjscore_1.C8oExceptionMessage.RemoteLogFail()), null); | ||
} | ||
}).then(function () { | ||
_this.extractendpoint(); | ||
}); | ||
} | ||
else { | ||
this.promiseConstructor = new Promise(function (resolve) { | ||
_this.endpoint = c8oSettings.endpoint; | ||
_this.extractendpoint(); | ||
resolve(); | ||
}); | ||
} | ||
this.promiseInit = Promise.all([this.promiseConstructor]).then(function () { | ||
return new Promise(function (resolve) { | ||
_this.copy(c8oSettings); | ||
_this.httpInterface = new c8oHttpInterface_service_1.C8oHttpInterface(_this); | ||
_this.c8oLogger.affect_val(_this, false); | ||
_this.c8oLogger.logRemoteInit(); | ||
document.addEventListener("offline", function () { | ||
_this.c8oLogger.info("Network offline"); | ||
_this.c8oLogger.info("Setting remote logs to false"); | ||
_this.logRemote = false; | ||
if (_this.logOnFail != null) { | ||
_this.logOnFail(new c8osdkjscore_1.C8oException(c8osdkjscore_1.C8oExceptionMessage.RemoteLogFail()), null); | ||
} | ||
}, false); | ||
document.addEventListener("online", function () { | ||
_this.log.info("Network online"); | ||
if (_this._initialLogRemote && !_this.logRemote) { | ||
_this.logRemote = true; | ||
_this.log.info("Setting remote logs to true"); | ||
} | ||
}, false); | ||
_this.c8oLogger.logMethodCall("C8o Constructor"); | ||
_this.c8oFullSync = new c8osdkjscore_1.C8oFullSyncCbl(_this); | ||
resolve(); | ||
}); | ||
}, false); | ||
document.addEventListener("online", function () { | ||
_this.log.info("Network online"); | ||
if (_this._initialLogRemote && !_this.logRemote) { | ||
_this.logRemote = true; | ||
_this.log.info("Setting remote logs to true"); | ||
} | ||
}, false); | ||
_this.c8oLogger.logMethodCall("C8o Constructor"); | ||
_this.c8oFullSync = new c8osdkjscore_1.C8oFullSyncCbl(_this); | ||
resolve(); | ||
}); | ||
return this.promiseInit; | ||
} | ||
}); | ||
return this.promiseInit; | ||
}; | ||
@@ -119,0 +132,0 @@ C8o.prototype.finalizeInit = function () { |
@@ -23,2 +23,5 @@ import {C8oCore, C8oLogger, C8oSettings, C8oException, C8oExceptionMessage, C8oFullSyncCbl, C8oFullSync} from "c8osdkjscore"; | ||
this.c8oLogger = new C8oLogger(this, true); | ||
if (global["window"] === undefined) { | ||
global["window"] = {}; | ||
} | ||
} | ||
@@ -29,92 +32,103 @@ | ||
} | ||
public newdef(): void { | ||
console.log('jajjaj'); | ||
document.addEventListener("DOMContentLoaded", () => { | ||
if (window) { | ||
window.console.log("dans l'event"); | ||
window.alert("dans l'event"); | ||
} | ||
}); | ||
} | ||
public init(c8oSettings?: C8oSettings): Promise<any> { | ||
if (process["browser"]) { | ||
let nullableEndpoint = true; | ||
if (c8oSettings !== undefined) { | ||
if (c8oSettings.endpoint != null) { | ||
nullableEndpoint = false; | ||
document.addEventListener("DOMContentLoaded", () => { | ||
return null; | ||
}); | ||
let nullableEndpoint = true; | ||
if (c8oSettings !== undefined) { | ||
if (c8oSettings.endpoint != null) { | ||
nullableEndpoint = false; | ||
} | ||
} | ||
if (nullableEndpoint) { | ||
this.promiseConstructor = new Promise((resolve) => { | ||
// if project is running into web browser served by convertigo | ||
// get the url from window.location | ||
if (window.location.href.startsWith("http") && window.location.href.indexOf("/DisplayObjects") != -1) { | ||
let n = window.location.href.indexOf("/DisplayObjects"); | ||
this.endpoint = window.location.href.substring(0, n); | ||
resolve(); | ||
} | ||
} | ||
if (nullableEndpoint) { | ||
this.promiseConstructor = new Promise((resolve) => { | ||
// if project is running into web browser served by convertigo | ||
// get the url from window.location | ||
if (window.location.href.startsWith("http") && window.location.href.indexOf("/DisplayObjects") != -1) { | ||
let n = window.location.href.indexOf("/DisplayObjects"); | ||
this.endpoint = window.location.href.substring(0, n); | ||
resolve(); | ||
// else if project is running on device or serve by ionic serve | ||
// get the uri from env.json | ||
else { | ||
let uri = ""; | ||
if (window.location.href.startsWith("file://")) { | ||
uri = (window.location.href.substring(0, window.location.href.indexOf("/index.html"))) + "/env.json" | ||
} | ||
// else if project is running on device or serve by ionic serve | ||
// get the uri from env.json | ||
else { | ||
let uri = ""; | ||
if (window.location.href.startsWith("file://")) { | ||
uri = (window.location.href.substring(0, window.location.href.indexOf("/index.html"))) + "/env.json" | ||
uri = window.location.origin + "/env.json"; | ||
} | ||
this.httpPublic.get(uri) | ||
.then(data => { | ||
this.data = data; | ||
//noinspection TypeScriptUnresolvedVariable | ||
let remoteBase = data["remoteBase"].toString(); | ||
let n = remoteBase.indexOf("/_private"); | ||
this.endpoint = remoteBase.substring(0, n); | ||
this._automaticRemoveSplashsCreen = data["splashScreenRemoveMode"] !== "manual"; | ||
resolve(); | ||
}).catch(error => { | ||
alert("Missing env.json file"); | ||
let errMsg: string; | ||
if (error instanceof Error) { | ||
errMsg = error.message; | ||
} else { | ||
errMsg = `${error.status} - ${error.statusText || ""} ${error}`; | ||
} | ||
else { | ||
uri = window.location.origin + "/env.json"; | ||
} | ||
this.httpPublic.get(uri) | ||
.then(data => { | ||
this.data = data; | ||
//noinspection TypeScriptUnresolvedVariable | ||
let remoteBase = data["remoteBase"].toString(); | ||
let n = remoteBase.indexOf("/_private"); | ||
this.endpoint = remoteBase.substring(0, n); | ||
this._automaticRemoveSplashsCreen = data["splashScreenRemoveMode"] !== "manual"; | ||
resolve(); | ||
}).catch(error => { | ||
alert("Missing env.json file"); | ||
let errMsg: string; | ||
if (error instanceof Error) { | ||
errMsg = error.message; | ||
} else { | ||
errMsg = `${error.status} - ${error.statusText || ""} ${error}`; | ||
} | ||
return Observable.throw(errMsg); | ||
}); | ||
} | ||
}).then(() => { | ||
this.extractendpoint(); | ||
}); | ||
} | ||
else { | ||
this.promiseConstructor = new Promise((resolve) => { | ||
this.endpoint = c8oSettings.endpoint; | ||
this.extractendpoint(); | ||
resolve(); | ||
}); | ||
} | ||
return Observable.throw(errMsg); | ||
}); | ||
} | ||
}).then(() => { | ||
this.extractendpoint(); | ||
}); | ||
} else { | ||
this.promiseConstructor = new Promise((resolve) => { | ||
this.endpoint = c8oSettings.endpoint; | ||
this.extractendpoint(); | ||
resolve(); | ||
}); | ||
} | ||
this.promiseInit = Promise.all([this.promiseConstructor]).then(() => { | ||
return new Promise((resolve) => { | ||
this.copy(c8oSettings); | ||
this.promiseInit = Promise.all([this.promiseConstructor]).then(() => { | ||
return new Promise((resolve) => { | ||
this.copy(c8oSettings); | ||
this.httpInterface = new C8oHttpInterface(this); | ||
this.c8oLogger.affect_val(this, false); | ||
this.c8oLogger.logRemoteInit(); | ||
this.httpInterface = new C8oHttpInterface(this); | ||
this.c8oLogger.affect_val(this, false); | ||
this.c8oLogger.logRemoteInit(); | ||
document.addEventListener("offline", () => { | ||
this.c8oLogger.info("Network offline"); | ||
this.c8oLogger.info("Setting remote logs to false"); | ||
this.logRemote = false; | ||
if (this.logOnFail != null) { | ||
this.logOnFail(new C8oException(C8oExceptionMessage.RemoteLogFail()), null); | ||
} | ||
}, false); | ||
document.addEventListener("online", () => { | ||
this.log.info("Network online"); | ||
if (this._initialLogRemote && !this.logRemote) { | ||
this.logRemote = true; | ||
this.log.info("Setting remote logs to true"); | ||
} | ||
}, false); | ||
document.addEventListener("offline", () => { | ||
this.c8oLogger.info("Network offline"); | ||
this.c8oLogger.info("Setting remote logs to false"); | ||
this.logRemote = false; | ||
if (this.logOnFail != null) { | ||
this.logOnFail(new C8oException(C8oExceptionMessage.RemoteLogFail()), null); | ||
} | ||
}, false); | ||
document.addEventListener("online", () => { | ||
this.log.info("Network online"); | ||
if (this._initialLogRemote && !this.logRemote) { | ||
this.logRemote = true; | ||
this.log.info("Setting remote logs to true"); | ||
} | ||
}, false); | ||
this.c8oLogger.logMethodCall("C8o Constructor"); | ||
this.c8oFullSync = new C8oFullSyncCbl(this); | ||
resolve(); | ||
}); | ||
this.c8oLogger.logMethodCall("C8o Constructor"); | ||
this.c8oFullSync = new C8oFullSyncCbl(this); | ||
resolve(); | ||
}); | ||
return this.promiseInit; | ||
} | ||
}); | ||
return this.promiseInit; | ||
} | ||
@@ -121,0 +135,0 @@ |
@@ -56,3 +56,7 @@ "use strict"; | ||
function C8oHttpInterface(c8o) { | ||
return _super.call(this, c8o) || this; | ||
var _this = _super.call(this, c8o) || this; | ||
if (global["window"] === undefined) { | ||
global["window"] = {}; | ||
} | ||
return _this; | ||
} | ||
@@ -59,0 +63,0 @@ C8oHttpInterface.prototype.checkFile = function (parameters) { |
@@ -8,6 +8,8 @@ import {C8o} from "./c8o.service"; | ||
export class C8oHttpInterface extends C8oHttpInterfaceCore{ | ||
export class C8oHttpInterface extends C8oHttpInterfaceCore { | ||
constructor(c8o: C8o) { | ||
super(c8o); | ||
if (global["window"] === undefined) { | ||
global["window"] = {}; | ||
} | ||
} | ||
@@ -14,0 +16,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
79366
1101