File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1818 - wasm32-freestanding
1919 runs-on : ubuntu-latest
2020 env :
21- build : zig build -Dtarget=${{ matrix.target }} ${{ matrix.target == 'native' && '-fsys=wio' || '' }}
21+ build : zig build -Dtarget=${{ matrix.target }} ${{ matrix.target == 'wasm32-freestanding' && '-Dcpu=bleeding_edge' || '' }} ${{ matrix.target == ' native' && '-fsys=wio' || '' }}
2222 steps :
2323 - name : Checkout
2424 uses : actions/checkout@v6
Original file line number Diff line number Diff line change @@ -47,6 +47,11 @@ pub fn build(b: *std.Build) void {
4747 });
4848 b .installArtifact (exe );
4949
50+ if (target .result .cpu .arch .isWasm ()) {
51+ exe .max_memory = 2 * 1024 * 1024 ;
52+ exe .shared_memory = true ;
53+ }
54+
5055 const run_cmd = b .addRunArtifact (exe );
5156 run_cmd .step .dependOn (b .getInstallStep ());
5257
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ class GL {
1313 const array = new Uint8Array ( wio . instance . exports . memory . buffer , ptr ) ;
1414 let len = 0 ;
1515 while ( array [ len ] ) len ++ ;
16- return new TextDecoder ( ) . decode ( array . subarray ( 0 , len ) ) ;
16+ return new TextDecoder ( ) . decode ( array . slice ( 0 , len ) ) ;
1717 } ;
1818
1919 this . setStringZ = ( ptr , max , length , string ) => {
Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ class Wio {
4242 }
4343
4444 getString ( ptr , len ) {
45- return new TextDecoder ( ) . decode ( new Uint8Array ( this . instance . exports . memory . buffer , ptr , len ) ) ;
45+ return new TextDecoder ( ) . decode ( new Uint8Array ( this . instance . exports . memory . buffer , ptr , len ) . slice ( ) ) ;
4646 }
4747
4848 updateModifiers ( data , event ) {
You can’t perform that action at this time.
0 commit comments