bucklescript-tea
Version:
TEA for Bucklescript
34 lines (29 loc) • 843 B
JavaScript
// Generated by BUCKLESCRIPT, PLEASE EDIT WITH CARE
;
var Curry = require("bs-platform/lib/js/curry.js");
var Caml_option = require("bs-platform/lib/js/caml_option.js");
function spawn(initState, update, shutdown) {
var state = {
contents: Caml_option.some(initState)
};
return (function (procMsg) {
var match = state.contents;
if (match !== undefined) {
var model = Caml_option.valFromOption(match);
if (procMsg) {
state.contents = Curry._2(update, model, procMsg[0]);
return /* () */0;
} else {
Curry._1(shutdown, model);
state.contents = undefined;
return /* () */0;
}
} else {
return /* () */0;
}
});
}
var testing1 = 42;
exports.spawn = spawn;
exports.testing1 = testing1;
/* No side effect */