mirror of
https://github.com/kiwix/kiwix-js-pwa.git
synced 2025-09-08 11:48:26 -04:00

Former-commit-id: fbd73e04b0798aedd86f63f2038c0b502ae8f8b3 [formerly 2c73ec151119e172268be547f0e25df9203be5d0] Former-commit-id: 1d2ba1ad573c128f15f475f71cb2c430c1a14b3c
38 lines
949 B
JavaScript
38 lines
949 B
JavaScript
// All of the Node.js APIs are available in the preload process.
|
|
// It has the same sandbox as a Chrome extension.
|
|
|
|
'use strict';
|
|
|
|
// const { remote } = require('electron');
|
|
// var win = remote.getCurrentWebContents();
|
|
const { open, read, close, stat } = require('fs');
|
|
|
|
console.log("Inserting required Electron functions into DOM...");
|
|
|
|
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]);
|
|
// }
|
|
// });
|
|
|