Make async, and test both wasm and asm using jest

This commit is contained in:
Nick Gerleman
2022-12-22 05:49:05 -08:00
parent 09f0869262
commit 5561d9e651
33 changed files with 1537 additions and 248 deletions

View File

@@ -76,7 +76,7 @@ class Size {
expose(this.width, this.height);
}
toString() {
toString() {s
return `<Size#${this.width}x${this.height}>`;
}
}
@@ -216,6 +216,10 @@ export type Yoga$Node = {
unsetMeasureFun(): void,
};
type YogaConstructor = {
initialize: () => Promise<Yoga>;
}
type Yoga = {
Config: {
create(): Yoga$Config,
@@ -234,7 +238,7 @@ type Yoga = {
...typeof CONSTANTS,
};
module.exports = (lib: any): Yoga => {
function wrapLib(lib: any): Yoga {
function patch(prototype, name, fn) {
let original = prototype[name];
@@ -374,3 +378,7 @@ module.exports = (lib: any): Yoga => {
...CONSTANTS,
};
};
module.exports = (libPromise: any) => ({
initialize: () => libPromise.then(wrapLib)
}: YogaConstructor);