yoga-layout-wasm
yoga-layout webassembly module, for browser and node. fallback to asm.js in non-webassembly environment
Get Start
$ npm i yoga-layout-wasm --save
{const Node = YogaNodeconst root = Node;root;root;root;const node1 = Node;node1;node1;const node2 = Node;node2;node2;root;root;root;console;// {left: 0, top: 0, width: 500, height: 300}console;// {left: 150, top: 0, width: 100, height: 100}console;// {left: 250, top: 0, width: 100, height: 100}}const wasmFilePath = 'node_modules/yoga-layout-wasm/dist/yoga.wasm'Yoga
asm.js
module
Single // *.jsYoga
Webpack and Auto Fallback
// ... webpack.config.jstest: /\.$/type: 'javascript/auto'use:loader: 'file-loader'options:name: '[path][name].[md5:hash:base64:6].[ext]'// ...
// *.jstypeof WebAssembly === 'undefined' ?import'yoga-layout-wasm/asm':import'yoga-layout-wasm';
Examples
$ npm run example:node
$ npm run example:html
$ npm run example:node:asm