diff --git a/docs-source/app/DrupalWorker.js b/docs-source/app/DrupalWorker.js index c6312824e..011ba55f8 100644 --- a/docs-source/app/DrupalWorker.js +++ b/docs-source/app/DrupalWorker.js @@ -31,8 +31,8 @@ self.addEventListener('fetch', event => event.respondWith(new Promise(accept => : event.request.formData().then((formData)=>{ const post = {}; - for (var key of formData.keys()) { - post[key] = formData.get(key); + for (const [key, value] of formData) { + post[key] = value; } return post; diff --git a/docs-source/app/initialize.js b/docs-source/app/initialize.js index ca46de756..55f75f918 100644 --- a/docs-source/app/initialize.js +++ b/docs-source/app/initialize.js @@ -41,15 +41,9 @@ document.addEventListener('DOMContentLoaded', () => { const renderAs = Array.from(document.querySelectorAll('[name=render-as]')); - openFile.addEventListener('input', event =>{ + openFile.addEventListener('input', event => { - const reader = new FileReader(); - - reader.onload = (event) => { - editor.setValue(event.target.result); - }; - - reader.readAsText(event.target.files[0]); + event.target.files[0].text().then(str => editor.setValue(str)); }); @@ -547,4 +541,3 @@ else }); }); - diff --git a/docs/index.html b/docs/index.html index 3448eea44..c1e81a1b4 100644 --- a/docs/index.html +++ b/docs/index.html @@ -4,7 +4,7 @@ @@ -228,4 +228,3 @@

php-wasm

- diff --git a/source/PhpBase.js b/source/PhpBase.js index 707b4486d..17c568797 100644 --- a/source/PhpBase.js +++ b/source/PhpBase.js @@ -1,4 +1,4 @@ -import { UniqueIndex } from './UniqueIndex'; +import { UniqueIndex } from './UniqueIndex.js'; const STR = 'string'; const NUM = 'number'; @@ -42,7 +42,7 @@ export class PhpBase extends EventTarget }; - const phpSettings = (window && window.phpSettings) ? window.phpSettings : {}; + const phpSettings = globalThis.phpSettings || {}; this.binary = new PhpBinary(Object.assign({}, defaults, phpSettings, args)).then(php=>{ diff --git a/source/PhpNode.js b/source/PhpNode.js index 265c16b8a..1c550b576 100644 --- a/source/PhpNode.js +++ b/source/PhpNode.js @@ -1,4 +1,4 @@ -import { PhpBase } from './PhpBase'; +import { PhpBase } from './PhpBase.js'; const PhpBinary = require('./php-node'); diff --git a/source/PhpShell.js b/source/PhpShell.js index 2dd5b4987..66cb08bd7 100644 --- a/source/PhpShell.js +++ b/source/PhpShell.js @@ -1,4 +1,4 @@ -import { PhpBase } from './PhpBase'; +import { PhpBase } from './PhpBase.js'; const PhpBinary = require('./php-shell'); @@ -10,7 +10,7 @@ export class PhpWeb extends PhpBase } } -if(window && document) +if(globalThis.document) { const php = new PhpWeb; diff --git a/source/PhpWeb.js b/source/PhpWeb.js index 79c991d24..d370acbd5 100644 --- a/source/PhpWeb.js +++ b/source/PhpWeb.js @@ -1,4 +1,4 @@ -import { PhpBase } from './PhpBase'; +import { PhpBase } from './PhpBase.js'; const PhpBinary = require('./php-web'); @@ -10,7 +10,7 @@ export class PhpWeb extends PhpBase } } -if(window && document) +if(globalThis.document) { const php = new PhpWeb; diff --git a/source/PhpWebDrupal.js b/source/PhpWebDrupal.js index f50c5e8ff..d6c55474c 100644 --- a/source/PhpWebDrupal.js +++ b/source/PhpWebDrupal.js @@ -1,4 +1,4 @@ -import { PhpBase } from './PhpBase'; +import { PhpBase } from './PhpBase.js'; const PhpBinary = require('./php-web-drupal'); @@ -10,7 +10,7 @@ export class PhpWebDrupal extends PhpBase } } -if(window && document) +if(globalThis.document) { const php = new PhpWebDrupal; diff --git a/source/PhpWebview.js b/source/PhpWebview.js index 336834ccb..3bd218ddd 100644 --- a/source/PhpWebview.js +++ b/source/PhpWebview.js @@ -1,4 +1,4 @@ -import { PhpBase } from './PhpBase'; +import { PhpBase } from './PhpBase.js'; const PhpBinary = require('./php-webview'); diff --git a/source/PhpWorker.js b/source/PhpWorker.js index 5f94f9d95..4f91c5e23 100644 --- a/source/PhpWorker.js +++ b/source/PhpWorker.js @@ -1,4 +1,4 @@ -import { PhpBase } from './PhpBase'; +import { PhpBase } from './PhpBase.js'; const PhpBinary = require('./php-worker');