Skip to content

eliseduverdier/cent-mille-milliards-de-poemes

Repository files navigation

cent-mille-milliards-de-poemes

Generate a poem among the Hundred Thousand Billion Poems, written by Raymond Queneau

Used AssemblyScript to play with WebAssembly

How not to use

Create your new repository and initialize it

mkdir my-assembly-app && cd $1
npm init
npm install --save-dev assemblyscript
npx asinit .

Check in assembly/index.ts, you should see an example export function add(...) generated by the assembly script.

Replace by the function you'd like (and don't forget to update the imports in the generated index.js)

Compile the WebAssembly binaries with

npm run asbuild or npm run asbuild:untouched

Everything should be fine until here :)

To test, try installing and running a local node server:

npm install --save-dev static-server
npm run serve-demo

It might fail, but if it runs, you should see in the console an error about wrong mime or something magic number

You can also launch node and requiring the index.js

node
const displayPoem = require('./index.js').displayPoem
displayPoem()

It should also fail. Happy debugging, I gave up :)