Skip to content

How to load wasm module? #7947

Closed Answered by linonetwo
linonetwo asked this question in Q&A
Jan 27, 2024 · 2 comments · 3 replies
Discussion options

You must be logged in to vote

Working example

import { widget as Widget } from '$:/core/modules/widgets/widget.js';
import { IChangedTiddlers } from 'tiddlywiki';

import { initSync } from './game/wasm/game';
import './index.css';

class ScpFoundationSiteDirectorGameWidget extends Widget {
  refresh(_changedTiddlers: IChangedTiddlers) {
    return false;
  }

  render(parent: Element, nextSibling: Element) {
    this.parentDomNode = parent;
    this.execute();
    const containerElement = $tw.utils.domMaker('div', {
      text: 'Loading game...',
    });
    nextSibling === null ? parent.append(containerElement) : nextSibling.before(containerElement);
    this.domNodes.push(containerElement);

    const gameWasm = $tw.w…

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
3 replies
@Jermolene
Comment options

@linonetwo
Comment options

@linonetwo
Comment options

Answer selected by linonetwo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants