Last active
December 26, 2016 23:27
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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