Skip to content

Instantly share code, notes, and snippets.

@giisyu
Last active December 26, 2016 23:27
Show Gist options
  • Save giisyu/49e24db4a46a74782ac1b11bc0023fe6 to your computer and use it in GitHub Desktop.
Save giisyu/49e24db4a46a74782ac1b11bc0023fe6 to your computer and use it in GitHub Desktop.
The Elm Architecture(0.18)effect moduleメモ ref: http://qiita.com/jooex/items/9cca8e4ec900b52ef30c
function spawnLoop(init, onMessage)
{
var andThen = _elm_lang$core$Native_Scheduler.andThen;
function loop(state)
{
var handleMsg = _elm_lang$core$Native_Scheduler.receive(function(msg) {
return onMessage(msg, state);
});
return A2(andThen, loop, handleMsg);
}
var task = A2(andThen, loop, init);
return _elm_lang$core$Native_Scheduler.rawSpawn(task);
}
function onMessage(msg, model)
{
...
}
var mainProcess = spawnLoop(initApp, onMessage);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment