Files
Igor Todorovski b21d0f8444 Update javascript CMakeLists.txt to add SUPPORT_BIG_ENDIAN (#1857)
Summary:
Add support for Big Endian in Yoga WASM so that it works on big endian platforms like Linux on Z, z/OS, AIX and others.

SUPPORT_BIG_ENDIAN - This makes generated JavaScript run on BE as well as LE machines: https://github.com/emscripten-core/emscripten/blob/6b8bba1add53b1f039717998fb784b7bdf5d510b/site/source/docs/tools_reference/settings_reference.rst#support_big_endian

Pull Request resolved: https://github.com/facebook/yoga/pull/1857

Reviewed By: rshest

Differential Revision: D83065095

Pulled By: arushikesarwani94

fbshipit-source-id: 6e75d96f1c29299efb394578273fb8c58879a0bf
2025-09-24 09:26:04 -07:00
..

yoga-layout

This package provides prebuilt WebAssembly bindings for the Yoga layout engine.

See more at https://yogalayout.dev

Usage

import {Yoga, Align} from 'yoga-layout';

const node = Yoga.Node.create();
node.setAlignContent(Align.Center);

Objects created by Yoga.<>.create() are not automatically garbage collected and should be freed once they are no longer in use.

// Free a config
config.free();

// Free a tree of Nodes
node.freeRecursive();

// Free a single Node
node.free();

Requirements

yoga-layout requires a toolchain that supports ES Modules and top-level await.

If top-level-await is not supported, use the yoga-layout/load entry point instead. This requires to load yoga manually:

import {loadYoga, Align} from 'yoga-layout/load';

const node = (await loadYoga).Node.create();
node.setAlignContent(Align.Center);