Skip to content

Commit

Permalink
temp
Browse files Browse the repository at this point in the history
  • Loading branch information
soyuka committed Sep 25, 2023
1 parent cfcb9a4 commit 81eee58
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 35 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ phpw(string filePath): void
```javascript
const STR = 'string';
ccall("phpw", null, [STR], ["public/index.php"]);
console.log(ccall("phpw_exec", STR, [STR], ["phpversion();"]);
console.log(ccall("phpw_exec", STR, [STR], ["phpversion();"]));
```

[More about how to call exposed functions](https://emscripten.org/docs/porting/connecting_cpp_and_javascript/Interacting-with-code.html?highlight=call#interacting-with-code-ccall-cwrap)
Expand Down
3 changes: 3 additions & 0 deletions demo/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
dist/
public/
!public/index.html
24 changes: 24 additions & 0 deletions demo/public/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<iframe id="output"></iframe>
<script type="module">
import Module from "./php-web.mjs";
const STR = "string";
const output = document.getElementById('output');
const buffer = ''

Module({
print(data) {
buffer += data;
// output.setAttribute('srcdoc', data);
},
printErr(data) {
if (data) {
console.log("stderr: ", data);
}
},
}).then(({ ccall, FS, IDBFS }) => {
console.log(ccall("phpw_exec", STR, [STR], ["phpversion();"]));

// Note that `/src` is the path we used when preloading!
// ccall("phpw", null, [STR], ["/src/index.php"]);
});
</script>
3 changes: 3 additions & 0 deletions demo/src/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?php

phpinfo();
34 changes: 0 additions & 34 deletions index.html

This file was deleted.

0 comments on commit 81eee58

Please sign in to comment.