mirror of
https://github.com/kiwix/kiwix-js-pwa.git
synced 2025-08-06 04:48:44 -04:00

# Conflicts: # package.json Former-commit-id: da712c4713a46f7f96a21f0aa54e7afe18292e86 [formerly c141b23dc1759511a7afc8bb05feeb3064c0965c [formerly 500ae1dc7b84dd775e07e9ba1f44015e311383ff]] Former-commit-id: 39301aad3da1fdf6b6fa76a576dc7b729cf86af1 Former-commit-id: af0535828880a403c8e1203868c839db5e25999c
46 lines
1.2 KiB
JavaScript
46 lines
1.2 KiB
JavaScript
// All of the Node.js APIs are available in the preload process.
|
|
// It has the same sandbox as a Chrome extension.
|
|
|
|
'use strict';
|
|
|
|
// DEV: TO SUPPORT ELECTRON ^12 YOU WILL NEED THIS
|
|
// const { contextBridge } = require('electron');
|
|
const { open, read, close, stat } = require('fs');
|
|
|
|
console.log("Inserting required Electron functions into DOM...");
|
|
|
|
// DEV: FOR ELECTRON ^12 DO IT THIS WAY:
|
|
// contextBridge.exposeInMainWorld('fs', {
|
|
// open: open,
|
|
// read: read,
|
|
// close: close,
|
|
// stat: stat
|
|
// });
|
|
|
|
window.fs = {
|
|
open: open,
|
|
read: read,
|
|
close: close,
|
|
stat: stat
|
|
};
|
|
// window.Buffer = Buffer;
|
|
|
|
// console.log(win.session.cookies);
|
|
|
|
// win.session.cookies.get({}, (error, cookies) => {
|
|
// console.log(cookies);
|
|
// });
|
|
|
|
|
|
// window.addEventListener('DOMContentLoaded', () => {
|
|
// const replaceText = (selector, text) => {
|
|
// const element = document.getElementById(selector)
|
|
// if (element) element.innerText = text;
|
|
// }
|
|
|
|
// for (const type of ['chrome', 'node', 'electron']) {
|
|
// replaceText(`${type}-version`, process.versions[type]);
|
|
// }
|
|
// });
|
|
|