2022-07-25 03:33:49 -04:00
|
|
|
import * as preload from '#preload';
|
|
|
|
|
|
2022-07-25 21:23:40 -04:00
|
|
|
console.log('#preload', preload);
|
|
|
|
|
|
2022-07-25 03:33:49 -04:00
|
|
|
const functions: any = (function() {
|
2022-07-29 00:01:01 -04:00
|
|
|
const electron = !!preload.versions;
|
2022-07-25 03:33:49 -04:00
|
|
|
const cordova = 'cordova' in globalThis;
|
|
|
|
|
|
|
|
|
|
if(electron) {
|
|
|
|
|
return preload;
|
|
|
|
|
} else {
|
2022-07-25 21:23:40 -04:00
|
|
|
let cid: string | null = null;
|
|
|
|
|
let homeServer: string | null = null;
|
2022-07-25 03:33:49 -04:00
|
|
|
return {
|
|
|
|
|
getClientId() {
|
|
|
|
|
return cid;
|
|
|
|
|
},
|
|
|
|
|
setClientId(id: any) {
|
|
|
|
|
cid = id;
|
|
|
|
|
},
|
2022-07-25 21:23:40 -04:00
|
|
|
getHomeServer() {
|
|
|
|
|
return homeServer;
|
|
|
|
|
},
|
|
|
|
|
setHomeServer(str: string) {
|
|
|
|
|
homeServer = str;
|
|
|
|
|
}
|
2022-07-25 03:33:49 -04:00
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
})();
|
|
|
|
|
|
|
|
|
|
|
2022-07-25 21:23:40 -04:00
|
|
|
console.log('native functions loaded', functions);
|
|
|
|
|
|
2022-07-25 03:33:49 -04:00
|
|
|
export const getClientId = functions.getClientId;
|
2022-07-25 21:23:40 -04:00
|
|
|
export const setClientId = functions.setClientId;
|
|
|
|
|
export const getHomeServer = functions.getHomeServer;
|
2022-07-29 00:01:01 -04:00
|
|
|
export const setHomeServer = functions.setHomeServer;
|
|
|
|
|
export const getSessionToken = functions.getSessionToken;
|
|
|
|
|
export const setSessionToken = functions.setSessionToken;
|