0.4.2 • Published 9 months ago

@rbxts/topo-runtime v0.4.2

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

topo-runtime

This package provides an API for writing systems in function hook-ish style. The approach allows for seamless hot-reloading and thus better DX.

Check out the make-jsx package which opens the possibility to make a UI in this style using JSX.

Loop

The Loop instance is required to use the hooks. It also collects debug information which could be used in debugger implementations.

Basic Setup

const loop = new Loop();

function someSystem() {
    // do something with hooks
}

const [step, evict] = loop.scheduleSystem(someSystem);
const connection = RunService.Heartbeat.Connect(step);

defineCleanupCallback(() => {
    connection.Disconnect();

    // If you want a cold reload (meaning all of the state will be reset)
    // you have to evict the system before scheduling the hot reloaded one;
    evict();
});

Hooks

Use useHookState function for implementing custom hooks. If you don't want to provide keys in hooks, use key value exported from this package.

There is topo-hooks package that provides a set of common hooks.

0.3.0

9 months ago

0.2.1

9 months ago

0.2.0

9 months ago

0.4.1

9 months ago

0.4.0

9 months ago

0.4.2

9 months ago

0.1.0

9 months ago

0.0.1

9 months ago