This repository has been archived on 2023-11-14. You can view files and clone it, but cannot push or open issues/pull-requests.
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() {
|
|
|
|
|
const electron = !!preload.getClientId;
|
|
|
|
|
const cordova = 'cordova' in globalThis;
|
|
|
|
|
|
|
|
|
|
console.log(preload);
|
|
|
|
|
|
|
|
|
|
// alert('Electron: ' + electron + '\nCordova: ' + cordova);
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
export const setHomeServer = functions.setHomeServer;
|