Build for each OS *
* Under the hood
let make = (~onClick, ()) => {
<View style=Style.[alignItems(`Center)]>
<Text
style=Style.[fontSize(20)]
text="Do eeeet"
/>
<Button width=200 title="Go" onClick />
</View>
}
type state = {count: int};
type action =
| Increment
| Decrement;
let reducer = (action, state) => {
switch (action) {
| Increment => {count: state.count + 1}
| Decrement => {count: state.count - 1}
};
};
let%component make = () => {
let%hook (state, dispatch) =
Hooks.reducer(~initialState={count: 0}, reducer);
let onPlus = _ => dispatch(Increment);
let onMinus = _ => dispatch(Decrement);
<View>
<Button onClick={onPlus} title="+" />
<Button onClick={onMinus} title="-" />
</View>;
};
npm and opam (OCaml) registries
npm install -g esy
esy add my-lib
esy add @opam/my-lib
#include "audio.h"
CAMLprim value SDL_playMusicCAML(value name, value volume)
{
CAMLparam2(name, volume);
const char *filename = String_val(name);
playMusic(filename, volume);
CAMLreturn(Val_unit);
}
Release and re-acquire the lock,
caml_release_runtime_system(); caml_acquire_runtime_system();
State machine visualization: https://xstate.js.org/viz/?gist=731a6bcc9291fe38e7edabdca3ce43ef
Clone revery-quick-start, https://github.com/revery-ui/revery-quick-start
esy install
esy build
esy run