GithubHelp home page GithubHelp logo

torch2424 / as-bind Goto Github PK

View Code? Open in Web Editor NEW
237.0 237.0 24.0 7.79 MB

Isomorphic library to handle passing high-level data structures between AssemblyScript and JavaScript πŸ€πŸš€

Home Page: https://torch2424.github.io/as-bind/

License: MIT License

TypeScript 7.46% JavaScript 4.88% WebAssembly 87.20% HTML 0.46%

as-bind's People

Contributors

aminya avatar deepkolos avatar dependabot[bot] avatar eventualbuddha avatar fgasper avatar mathe42 avatar maxime-petitjean avatar piotr-oles avatar surma avatar torch2424 avatar tylervipond avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

as-bind's Issues

provide AsBind.instantiateSync

It should be really interesting to have a way of using AsBind synchronously, could simplify integration with tests and other things without the hasle of handling all the asynchronous things.

Here is what I do:

// index.js
const { AsBind } = require('as-bind')
const fs = require('fs')
module.exports = AsBind.instantiate(
  fs.readFileSync(`${__dirname}/build/optimized.wasm`), {}
)
// test/main.test.js
let ex = {
  main: require('..')
}
function generic_test (obj, key, tests) {
  return function () {
    for (let index in tests) {
      let { input, output } = tests[index]
      it(`${Number(index) + 1}) with "${JSON.stringify(input)}": should return ${output}`,
        async function () {
          if (ex.main instanceof Promise) ex.main = await ex.main
          let func = ex.main.exports[key]
          if (!func) this.skip()
          let result = func(...input)
          if (JSON.stringify(result) !== JSON.stringify(output)) { throw new Error(`found ${result} instead of ${output}`) }
        }
      )
    }
  }
}

describe('0) Add two numbers', generic_test(ex, 'add', [
  { input: [1, 2], output: 3 },
]))

Here is what I expect to do:

// index.js
const { AsBind } = require('as-bind')
const fs = require('fs')
module.exports = AsBind.instantiateSync(
  fs.readFileSync(`${__dirname}/build/optimized.wasm`), {}
)
// test/main.test.js
let ex = require('..')

function generic_test (func, tests) {
  return function () {
    for (let index in tests) {
      let { input, output } = tests[index]
      it(`${Number(index) + 1}) with "${JSON.stringify(input)}": should return ${output}`,
        function () {
          if (!func) this.skip()
          let result = func(...input)
          if (JSON.stringify(result) !== JSON.stringify(output)) { throw new Error(`found ${result} instead of ${output}`) }
        }
      )
    }
  }
}

describe('0) Add two numbers', generic_test(ex.add, [
  { input: [1, 2], output: 3 },
]))

u16 buggy

I got a function that I want to export:

export function foo(): u16 {
..
}

If I access that function directly through unboundExports it works, but through as-bind it tries to interpret it as a string for some reason: Uncaught Error: not a string: 516.

u8 is working btw.

Hello World example appears to return number

Hey @torch2424, hope you're good! I was just playing around with the hello world example and noticed it was return an integer instead of a string.

For example if I compile:

export function myExportedFunctionThatTakesAString(value: string): string {
  return "AsBind: " + value;
}

Then in Node run:

const { AsBind } = require("as-bind");
const fs = require("fs");
const wasm = fs.readFileSync("./build/optimized.wasm");

(async () => {
  const asBindInstance = await AsBind.instantiate(wasm);

  const result = asBindInstance.exports.myExportedFunctionThatTakesAString("Hello World!");
  console.log("result", result);
})();

I'm getting a numeric response like 2944. Is there a possibility it's returning the memory pointer by any chance? Running latest as-bind and assemblyscript npm modules currently.

I could also be missing something very obvious πŸ˜…

RFE: Document the metadata format

This library looks awesome!

For interop purposes, I wonder if it’s stable enough that the actual metadata format could be documented? It looks simple enough …

Imported JavaScript function always returning NaN

I have an AssemblyScript import that looks like this:

export declare function doSomething(): f64;

doSomething is just a JavaScript function that returns a number. Whenever I use it in AssemblyScript and try to get the value back to JavaScript, it returns NaN.

TODO

  • Make a Dope Markdown / Wasm Vs. ES6 Benchmark / Vs. Rust (maybe not rust?)
  • Make a Dope README
  • Get Feedback from the team

TS7016: Could not find a declaration file for module 'as-bind'

I'm trying to use as-bind from typescript but it looks like the location of the typings file in as-bind is non-standard, and there's also no "types" field for it in package.json.

[!] (plugin typescript) Error: @rollup/plugin-typescript TS7016: Could not find a declaration file for module 'as-bind'. 'C:/.../node_modules/as-bind/dist/as-bind.cjs.js' implicitly has an 'any' type.
  Try `npm install @types/as-bind` if it exists or add a new declaration (.d.ts) file containing `declare module 'as-bind';`

Strings can get corrupted, due to them not being a Pinned GC Object

From the AssemblyScript discord:

Rehkitz β€” 07/05/2021
hello I'm using Asbind. What should I do when my strings gets corrupted when calling a wasm function from js with string parameters?
./assets/shaders/instance.vert gets to ./assets/shaders/instance.ve萼� in wasm. Did I mess up my assembly script memory? Bug in Asbind?
Any Ideas how to fix this?
It worked fine. It just started occurring when I created a new object in my class.

MaxGraey β€” 07/05/2021
it looks like memory corruption due to not pinned gc object. cc @torch2424

Rehkitz β€” 07/05/2021
hey @torch2424 . I used the version 0.7.1. I converted the values now by hand with __newstring and __pin right after the strings gets created.
That fixed the issue. I pass 4 strings to wasm with e.on_shader_loaded(vert_path_ptr, frag_path_ptr, vert_code_ptr, frag_code_ptr);
These string can be quite long. I guess I have to remember to __pin values that come from js.

cc @surma , just FYI πŸ˜„

import {AsBind} undefined with webpack?

Hi! I'm new to trying to use as-bind with assemblyscript. I followed the installation instructions however when I try and run my javascript I'm receiving AsBind as undefined...

I have defined the import {AsBind} from "as-bind"; within my javascript. Additionally, I have even tried using const {AsBind} = require("as-bind"); with both producing the same result...

My project is using webpack so its unclear if that has anything to with it. I am using version 0.3.2.

Using this import asbind from "../node_modules/as-bind/dist/as-bind.esm"; appears to work. I found something similar in the markdown-parser example.

Thanks!

More Optimizations

From @MaxGraey in the Assemblyscript slack:

btw about opts. You could significantly speedup interop here and similar places:
https://github.com/torch2424/as-bind/blob/master/lib/supported-ref-types.js#L128

just use wasmExports.__getFloat32Array(responseRef).slice() instead
Float32Array.from(wasmExports.__getArray(responseRef))
Sometimes you could even don’t use slice if that result will use immediately) Adding .slice() (cloning) just for safety

similar for FLOAT64ARRAY, UINT32ARRAY and etc

Access parent object in .call ?

Asbind.call(myModule.exports.myFunction)

Is there a prototype chain I can access from just my Function? πŸ€” That way the call command can be cleaner?

And can I access the parent Asbind from this.prototype?

Migration to AS v0.18

Are there any plans to migrate to AssemblyScript v0.18?

Our initial attempts tend to indicate that backward compatibility was lost then.

Handle AssemblyScript's typed Array syntax

Hi!

Thanks again for this great project!

I was playing with some AssemblyScript code and was surprised by the difference between i8[] and Int8Array.

For example, let's say I have:

export function getInt8ArrayLength(array: i8[]): i32 {
  return array.length;
}

Then when I execute it like this:

getInt8ArrayLength(new Int8Array(3));

I get unrelated numbers like 44381.

Now, I'm not very familiar with AssemblyScript so I am not sure if this should simply be forbidden (explicit runtime error?) or correctly handled. I was able to reproduce that behavior in AssemblyScript directly:

export function getInt32ArrayLength(a: i32[]): i32 { return a.length; }
export const Int32Array_ID = idof<Int32Array>();
export const i32a_ID = idof<i32[]>();

Then:

getInt32ArrayLength(__newArray(Int32Array_ID, new Int32Array(3))); // returns a wrong integer
getInt32ArrayLength(__newArray(i32a_ID, new Int32Array(3))); // works well

So the question is: do we have any way to know if the exported function argument's types?

I've started a branch here https://github.com/sutoiku/as-bind/tree/as-typed-arrays with tests that reproduces the behavior:
image

Let me know your thoughts.

Thanks!

Y.

Deriving typed array ids from RTTI

This is a little idea to get rid of the requirement to specify an additional entry file.

Instead of exporting the IDs, it is also possible to obtain these from RTTI, which is located in static memory at exports.__rtti_base. RTTI is somewhat limited, but as-bind's currently supported types fit it well.

// ╒═══════════════════ Typeinfo interpretation ═══════════════════╕
//    3                   2                   1
//  1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0  bits
// β”œβ”€β”΄β”€β”΄β”€β”΄β”€β”΄β”€β”΄β”€β”΄β”€β”΄β”€β”΄β”€β”΄β”€β”΄β”€β”΄β”€β”΄β”€β”΄β”€β”΄β”€β”΄β”€β”΄β”€β”΄β”€β”΄β”€β”΄β”€β”΄β”€β”΄β”€β”΄β”€β”΄β”€β”΄β”€β”΄β”€β”΄β”€β”΄β”€β”΄β”€β”΄β”€β”΄β”€β”΄β”€β”€ ◄─ __rtti_base
// β”‚                             count                             β”‚
// β•žβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•‘ ┐
// β”‚                      Typeinfo#flags [id=0]                    β”‚ id < count
// β”œ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─
// β”‚                      Typeinfo#base  [id=0]                    β”‚
// β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
// β”‚                              ...                              β”‚

All the ArrayBufferViews have a special flag TypeinfoFlags.ARRAYBUFFERVIEW. Their integer or floating point type can be derived from TypeinfoFlags.VALUE_ALIGN_X in combination with TypeinfoFlags.VALUE_SIGNED and TypeinfoFlags.VALUE_FLOAT.

However, doing so imposes the limitation that if no Int16Array for example is used within the module, it won't be present in RTTI. Instantiating one should not be useful anyway in this case as there is nothing accepting an Int16Array on the Wasm side.

This would also work with Array<T>. These use TypeinfoFlags.ARRAYBUFFERVIEW | TypeinfoFlags.ARRAY and have the same flags otherwise. However, special care must be taken if T is managed, which is indicated by TypeinfoFlags.VALUE_MANAGED.

The other supported types have fixed IDs btw and are always present, so one doesn't need an export for these:

  • ArrayBuffer: 0
  • String: 1
  • ArrayBufferView: 2 (this can be used to find typed arrays, which use this ID as a base)

Add support for Array<T>

It's been requested by a few users, and there was some discussion in the AssemblyScript repo. I think it shouldn't be too hard to add, so let's go ahead and add support for it.

as-bind seems to not be able to handle proxies?

I’m not 100% sure I dug out the very core issue here, but I put a sufficiently minimal repro in a gist, which will hopefully help analyze the bug.

I import a function which takes a string as a parameter, which is working fine with as-bind. However, some of my functions rely on this being the object the imported function is defined on. So I thought I’d bind() all functions before importing. as-bind handles that, too. Then I thought I should do the binding lazily, so I added a Proxy that does the binding on GET and caches it in a Map. Now, as-bind is failing to do its job and I just get a pointer.

import { AsBind } from "as-bind";
// Bundler magic compiles my ASC for me
import wasmUrl from "asc:./main.ts";

// Manually binds all methods found on `obj` to `obj.
function manualbind(obj) {
  const returnobj = {};
  for (const key of Object.keys(obj)) {
    if (typeof obj[key] === "function") {
      returnobj[key] = obj[key].bind(obj);
    }
    returnobj[key] = obj[key];
  }
  return returnobj;
}

// *Lazily* binds all methods found on `obj` to `obj.
function proxybind(obj) {
  const bindCache = new Map();
  return new Proxy(obj, {
    get(target, p) {
      if (bindCache.has(p)) {
        return bindCache.get(p);
      }
      if (typeof target?.[p] === "function") {
        const bound = target[p].bind(target);
        bindCache.set(p, bound);
        return bound;
      }
      return target[p];
    },
  });
}

function myalert(s) {
  alert(`message: ${JSON.stringify(s)}, has a this: ${this !== null}`);
}

async function main() {
  // Works fine!
  const instance = await AsBind.instantiate(fetch(wasmUrl), {
    main: { myalert },
  });
  instance.exports.run("vanilla");

  // Works fine!
  const instance2 = await AsBind.instantiate(fetch(wasmUrl), {
    main: manualbind({ myalert }),
  });
  instance2.exports.run("manualbind");

  // Breaks. I only get a pointer value and not the string.
  const instance3 = await AsBind.instantiate(fetch(wasmUrl), {
    main: proxybind({ myalert }),
  });
  instance3.exports.run("proxybind");
}
main();

Can you take a look and let me know if it’s something that I am doing wrong or something we can fix in as-bind?

The new version(0.7.0) doesn't work.

First of all, thank you for providing such a great library!

Nice work on the update to @0.7.0.
I realized that default export and some other features has changed.

I tried it on my local environment (Win10, node14, with asc) but it didn't work.
I'll just paste the error message...

> asc assembly/index.ts --exportRuntime --transform as-bind --target debug

FAILURE C:\Users\sur6p\OneDrive\Desktop\gr\node_modules\as-bind\dist\transform.cjs.js:1
"use strict";function e(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var t=e(require("visitor-as/as"));const{CommonFlags:n,NodeKind:r}=t;function i(e){return e.internalName.startsWith("~")}function s(e,t){return 0!=(e.flags&t)}function a(e){var t;return(null===(t=e.getClass())||void 0===t?void 0:t.internalName)??e.toString()}function o(e){let t=e.parent;for(;t!==t.parent;)t=t.parent;return t}function c(e){return{returnType:a(e.signature.returnType),parameters:e.signature.parameterTypes.map((e=>a(e)))}}function u(e){var t;const n={},r=null===(t=e.getClass)||void 0===t?void 0:t.call(e);if(!r)return n;if(n[r.internalName]={id:r.id,byteSize:r.nextMemoryOffset},r.typeArguments)for(const e of r.typeArguments

SyntaxError: Unexpected token ?
    at Module._compile (internal/modules/cjs/loader.js:872:18)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:947:10)
    at Module.load (internal/modules/cjs/loader.js:790:32)
    at Function.Module._load (internal/modules/cjs/loader.js:703:12)
    at Module.require (internal/modules/cjs/loader.js:830:19)
    at require (internal/modules/cjs/helpers.js:68:18)
    at Object.main (C:\Users\sur6p\OneDrive\Desktop\gr\node_modules\assemblyscript\cli\asc.js:520:25)
    at C:\Users\sur6p\OneDrive\Desktop\gr\node_modules\assemblyscript\bin\asc:19:47

in the js file, I was just calling as-bind like this;

import { instantiate } from "as-bind"; // there was no default export so imported it directly

const fetchAndInstantiateTask = async () => {
  const wasmArrayBuffer = await fetch(wasmModuleUrl).then((response) =>
    response.arrayBuffer()
  );
  return instantiate(wasmArrayBuffer, importObject);
};
const response = await fetchAndInstantiateTask();
return response

Since I'm new to the WASM and AS, I have no idea what is going on..
I hope this helps. thanks in advance.

Add links to as-loader package

Hi! πŸ‘‹πŸ»
In the last few weeks, I was working on the as-loader package (loader for webpack).
It has built-in support for as-bind and has a similar goal to achieve - improve DX with AssemblyScript. I will not advertise the as-loader more, you can read in REAMDE.md what features it provides πŸ˜„
Could we add some links in the docs to point other developers to this package?

Incorrect result in normal `for` loop [Question]

I am trying to build this function, but its result is always 0. What am I doing wrong? The readme doesn't help in using arrays.

wasm.ts

export function for_array(arr: Array<f64>): f64 {
  let sum = 0.0
  for (let i= 0, l= arr.length; i < l; ++i) {
    sum += arr[i]
  }
  return sum
}

asbind_loader.ts:

import fs from "fs"
const { AsBind } = require("as-bind");
const wasm = fs.readFileSync("./build/release.wasm");
export const myWasm = AsBind.instantiateSync(wasm)

index.ts

import {myWasm} from './asbind_loader';
const arr = new  Float64Array([1,2,3])     // I am not sure if this conversion is needed!
console.log(myWasm.exports.for_array(arr));

scripts commands:

    "start": "node --experimental-modules --experimental-wasm-modules ./dist/index.js",
    "asbuild ": "asc ./node_modules/as-bind/lib/assembly/as-bind.ts wasm.ts -b build/release.wasm -t build/release.wat --validate -O3",
    "copy": "shx rm -rf dist/build/ && shx cp -r build dist/build/",
    "build": "npm run asbuild && tsc -p ./tsconfig.json && npm run copy",

[Feature Request] add binding support for declare fucntion exported in a namespace

namespace console {
  export declare function log(str: string): void;
}

declare function consoleLog(str: string): void;

export function log(str: string): void {
  console.log(str);
  consoleLog(str);
}
<script type="module">
  import * as AsBind from './node_modules/as-bind/dist/as-bind.esm.js';
  const memory = new WebAssembly.Memory({ initial: 1 });
  AsBind.instantiate(
    fetch('./build/as-bind.wasm').then(i => i.arrayBuffer()),
    {
      env: { memory },
      'as-bind': {
        'console.log': str => console.log(str), // 3088 (string's ptr)
        consoleLog: str => console.log(str), // test
      },
    },
  ).then(exports => {
    exports.exports.log('test');
  });
</script>

Port as-bind to TypeScript

related to #52
related to #41

We've had some issues with the typings. But all in all, it'd probably just be better to port everything to typescript for the type garuntees, and then just upload the TypeScript Source and things. πŸ˜„

In the meantime we will just commit the Typings sin to get things working in TypeScript projects 😒 (PRs welcome for a proper typings file! πŸ˜„ ) : https://www.stevefenton.co.uk/2013/01/complex-typescript-definitions-made-easy/

Bound exports seem to be returning Wasm pointers

I'm not sure if I'm doing this incorrectly, but as-bind doesn't seem to be returning the data types that I want, just the Wasm pointers are some other pointer is coming back:

In my AssemblyScript:

export function testString(theString: string): string {
    return theString;
}

In my JavaScript (not exactly my source code as I'm working on integration with Zwitterion):

import { AsBind } from 'as-bind';

(() => {
  const wasm = new Uint8Array([0,97,115,109,1,0,0,0,1,44,8,96,2,127,127,1,127,96,0,0,96,3,...]); // example wasm
  const exports = (await AsBind.instantiate(wasm)).exports;

  console.log(exports.testString('hello world'));
})();

This logs 1888, not hello world. Am I missing something with the API?

Look into handling Class constructors

Per a discussion in the AssemblyScript slack, it seems like there is some weird behavior with contstructors. Particularly how they are bound when creating the ASBind instance. (The discussion is in the help channel in the AS Discord)

Thanks for the investigation @battlelinegames ! πŸ˜„

feature request: pass arbitrary functions (not just exports) from AS to JS, or vice versa.

Use case:

We want to make, for example, a requestAnimationFrame function and pass that into Wasm via the imports object.

The AssemblyScript user should be able to dynamically create and pass any callback to this function.

So on the JavaScript side, it would be something like:

const imports = {
  requestAnimationFrame(assemblyscriptFunction) {
    // call assemblyscriptFunction at some point, f.e.
    requestAnimationFrame(assemblyscriptFunction)
  }
}

Problem is, at the moment, assemblyscriptFunction is an AssemblyScript pointer number. So the above won't work.

I'm not sure how to get a function using its pointer and call it, but once we know how to do that, then we can abstract it in as-bind.


Similarly, although maybe less useful, we should be able to pass JS functions into an AS function going the other way.

Does as-bind work with the newest assemblyscript version?

When trying to install as-bind I get the following error:

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: [email protected]
npm ERR! Found: @assemblyscript/[email protected]
npm ERR! node_modules/@assemblyscript/loader
npm ERR!   @assemblyscript/loader@"^0.19.7" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer @assemblyscript/loader@"0.18.x" from [email protected]
npm ERR! node_modules/as-bind
npm ERR!   as-bind@"*" from the root project

It seems to look for @assemblyscript/loader@"0.18.x" . The current version is 0.19.7.

Steps to reproduce:

npm init
npm install --save-dev assemblyscript
npm install --save as-bind

How to add more types / plans going forward

Was chatting in the AS discord about AS bind, and figured this would be good to document in an issue as well πŸ˜„


  1. Identify the data id in: https://github.com/torch2424/as-bind/blob/master/lib/assembly/as-bind.ts#L15
  2. Pull the data out of linear memory by it's layout: https://www.assemblyscript.org/interoperability.html#class-layout or https://www.assemblyscript.org/memory.html#internals

I do think that library would be helpful for general Data management in a JS app, and could allow for a "Everything is a data view", making things similar on the implementation side. But I wouldn't want to force users into using a specific library, or inflate the code size (It's not super big at 11kb, but currently we sit around 4kb + tree-shakable): https://bundlephobia.com/[email protected]
What we probably want to do, per the steps I mentioned above, is expose the Standard Library automatically in the as-bind entry file.

And for custom objects, is offer a way in both JS and AS land to pass around custom objects using like a function call.

That also being said, I know per the working meeting, there's plans to build an AS bindgen soon-ish. Which would then be the preffered way to handle this. :slight_smile: But I don't know how soon is soon haha!

Support assemblyscript 0.9.x

// as side
export function someFunc(arr: Float64Array): void {
  // some stuff
}

// js side
someFunc(new Float64Array([1.1, 1.2, 1.3]))
/Users/darky/Projects/bla-bla/node_modules/as-bind/dist/as-bind.cjs.js:1
RuntimeError: unreachable

0.8.x version fine

Launch TODO

  • Fix the bugs, and finish core of Markdown parser

  • Create a quick demo of the markdown parser, with a debouched input field and things, and links to asbind

  • Have console logs show the generated HTML from the assemblyscript module (show off binding imports)

  • Clean up API, make new AsBind, in which modules have instances.

  • Add speculative execution support, E.g (if it was a string on the first run, it's probably a string again)

  • Add a way for users to disable the speculative execution

  • Write README

  • Add Wat files to their respective wasm files for github to pick up the repo as a wasm repo

  • Make sure the as-bind is consistent. no asbind

  • Add Travis support for when PRs are opened, tests are run

  • Close #2

  • Write Medium Article

  • Write Tweet

  • Launch

Post Launch

  • Add support for Custom created object classes. (Was going to do in launch, but honestly seems super complicated, and will need some help from the library team. Let's see how well the library launches first πŸ˜„ )

Investigate TODO from #29

Found a weird memory / reference race condition thingy in the tests. Probably worth doing some more investigating. As it seems to work fine in CI, but was acting up on my machine πŸ€”

Error using IIFE AsBind

Hi there,

I've run into the following error whenever I try to use the AsBindIIFE.AsBind.instantiate function:

as-bind.iife.js:11 Uncaught (in promise) Error: Required Exported AssemblyScript Runtime functions are not present. Runtime must be set to "full" or "stub"

Any idea what the issue is? I've tried setting the runtime like so in my package.json:

    "asbuild:untouched": "asc ./node_modules/as-bind/lib/assembly/as-bind.ts assembly/index.ts --target debug --runtime full",

But that seems to have had no effect.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.