Skip to content

Commit

Permalink
Make undefined of wasmCode after instantiate
Browse files Browse the repository at this point in the history
  • Loading branch information
ilgonmic committed Jan 30, 2024
1 parent 56def06 commit b0523e7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
5 changes: 2 additions & 3 deletions examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,15 +160,13 @@ import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import org.jetbrains.compose.resources.ExperimentalResourceApi
import org.jetbrains.compose.resources.painterResource

//sampleStart
@OptIn(ExperimentalComposeUiApi::class)
fun main() {
CanvasBasedWindow(canvasElementId = "ComposeTarget") { App() }
}

@OptIn(ExperimentalResourceApi::class)
@Composable
fun App() {
MaterialTheme {
Expand Down Expand Up @@ -209,6 +207,7 @@ class Greeting {
interface Platform {
val name: String
}
//sampleEnd

```

Expand Down
4 changes: 2 additions & 2 deletions src/js-executor/execute-es-module.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ export async function executeWasmCode(container, jsCode, wasmCode) {
` +
jsCode
.replace(
"instantiateStreaming(fetch(wasmFilePath)",
"instantiate(window.wasmCode"
"instantiateStreaming(fetch(wasmFilePath), importObject)).instance;",
"instantiate(window.wasmCode, importObject)).instance;\nwindow.wasmCode = undefined;"
)
.replace(
"const importObject = {",
Expand Down

0 comments on commit b0523e7

Please sign in to comment.