-
Notifications
You must be signed in to change notification settings - Fork 581
Run examples with php wasm #1097
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
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -105,6 +105,13 @@ if (!empty($_SERVER['BASE_PAGE']) | |
echo '<script src="/cached.php?t=' . @filemtime($path) . '&f=/js/' . $filename . '"></script>' . "\n"; | ||
} | ||
?> | ||
<?php | ||
$jsfiles = ["interactive-examples.js"]; | ||
foreach ($jsfiles as $filename) { | ||
$path = dirname(__DIR__) . '/js/' . $filename; | ||
echo '<script type="module" src="/cached.php?t=' . @filemtime($path) . '&f=/js/' . $filename . '"></script>' . "\n"; | ||
} | ||
?> | ||
|
||
<a id="toTop" href="javascript:;"><span id="toTopHover"></span><img width="40" height="40" alt="To Top" src="/images/[email protected]"></a> | ||
|
||
|
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,62 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
import phpBinary from "/js/php-web.mjs"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
function createOutput(output) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
const container = document.createElement('div'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
container.classList.add('screen', 'example-contents'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
const title = document.createElement('p'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
title.innerText = 'Output: '; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
container.appendChild(title) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
const div = document.createElement('div'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
div.classList.add('examplescode'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
container.appendChild(div); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
const pre = document.createElement('pre'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
pre.classList.add('examplescode'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
pre.innerText = output; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
div.appendChild(pre) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
return container; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
const container = document.createElement('div'); | |
container.classList.add('screen', 'example-contents'); | |
const title = document.createElement('p'); | |
title.innerText = 'Output: '; | |
container.appendChild(title) | |
const div = document.createElement('div'); | |
div.classList.add('examplescode'); | |
container.appendChild(div); | |
const pre = document.createElement('pre'); | |
pre.classList.add('examplescode'); | |
pre.innerText = output; | |
div.appendChild(pre) | |
return container; | |
const container = document.createElement('div'); | |
container.classList.add('screen', 'example-contents'); | |
const title = document.createElement('p'); | |
title.innerText = 'Output: '; | |
container.appendChild(title); | |
const div = document.createElement('div'); | |
div.classList.add('examplescode'); | |
container.appendChild(div); | |
const pre = document.createElement('pre'); | |
pre.classList.add('examplescode'); | |
pre.innerText = output; | |
div.appendChild(pre); | |
return container; |
CS
soyuka marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this use .innerText
or .textContent
here ? innerText
is impacted by the styles of the page
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no idea 🤷
Large diffs are not rendered by default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe that this deserves only one line?