Skip to content

few small improvements #29

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs-source/app/DrupalWorker.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
11 changes: 2 additions & 9 deletions docs-source/app/initialize.js
Original file line number Diff line number Diff line change
Expand Up @@ -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));

});

Expand Down Expand Up @@ -547,4 +541,3 @@ else
});

});

3 changes: 1 addition & 2 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<script type="text/javascript">{
// Allow the page to be served from any directory...
const path = location.pathname.replace(/index.html$/, '');
path.match(/\/$/) || window.location.replace(
path.match(/\/$/) || location.replace(
path+'/'+(location.search||'')
);
}</script>
Expand Down Expand Up @@ -228,4 +228,3 @@ <h1>php-wasm</h1>
</div>
</div>
</body>

4 changes: 2 additions & 2 deletions source/PhpBase.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { UniqueIndex } from './UniqueIndex';
import { UniqueIndex } from './UniqueIndex.js';

const STR = 'string';
const NUM = 'number';
Expand Down Expand Up @@ -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=>{

Expand Down
2 changes: 1 addition & 1 deletion source/PhpNode.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PhpBase } from './PhpBase';
import { PhpBase } from './PhpBase.js';

const PhpBinary = require('./php-node');

Expand Down
4 changes: 2 additions & 2 deletions source/PhpShell.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PhpBase } from './PhpBase';
import { PhpBase } from './PhpBase.js';

const PhpBinary = require('./php-shell');

Expand All @@ -10,7 +10,7 @@ export class PhpWeb extends PhpBase
}
}

if(window && document)
if(globalThis.document)
{
const php = new PhpWeb;

Expand Down
4 changes: 2 additions & 2 deletions source/PhpWeb.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PhpBase } from './PhpBase';
import { PhpBase } from './PhpBase.js';

const PhpBinary = require('./php-web');

Expand All @@ -10,7 +10,7 @@ export class PhpWeb extends PhpBase
}
}

if(window && document)
if(globalThis.document)
{
const php = new PhpWeb;

Expand Down
4 changes: 2 additions & 2 deletions source/PhpWebDrupal.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PhpBase } from './PhpBase';
import { PhpBase } from './PhpBase.js';

const PhpBinary = require('./php-web-drupal');

Expand All @@ -10,7 +10,7 @@ export class PhpWebDrupal extends PhpBase
}
}

if(window && document)
if(globalThis.document)
{
const php = new PhpWebDrupal;

Expand Down
2 changes: 1 addition & 1 deletion source/PhpWebview.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PhpBase } from './PhpBase';
import { PhpBase } from './PhpBase.js';

const PhpBinary = require('./php-webview');

Expand Down
2 changes: 1 addition & 1 deletion source/PhpWorker.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PhpBase } from './PhpBase';
import { PhpBase } from './PhpBase.js';

const PhpBinary = require('./php-worker');

Expand Down