cheatsheet/elm.js
function makeEmbedHelp(moduleName, program, rootDomNode, flags)
{
	var init = program.init;
	var update = program.update;
	var subscriptions = program.subscriptions;
	var view = program.view;
	var makeRenderer = program.renderer;

	// ambient state
	var managers = {};
	var renderer;

	// init and update state in main process
	var initApp = _elm_lang$core$Native_Scheduler.nativeBinding(function(callback) {
		var results = init(flags);
		var model = results._0;
		renderer = makeRenderer(rootDomNode, enqueue, view(model));
		var cmds = results._1;
		var subs = subscriptions(model);
		dispatchEffects(managers, cmds, subs);
		callback(_elm_lang$core$Native_Scheduler.succeed(model));
	});

	function onMessage(msg, model)
	{
		return _elm_lang$core$Native_Scheduler.nativeBinding(function(callback) {
			var results = A2(update, msg, model);
			model = results._0;
			renderer.update(view(model));
			var cmds = results._1;
			var subs = subscriptions(model);
			dispatchEffects(managers, cmds, subs);
			callback(_elm_lang$core$Native_Scheduler.succeed(model));
		});
	}

	var mainProcess = spawnLoop(initApp, onMessage);

	function enqueue(msg)
	{
		_elm_lang$core$Native_Scheduler.rawSend(mainProcess, msg);
	}

	var ports = setupEffects(managers, enqueue);

	return ports ? { ports: ports } : {};
}
function makeEmbedHelp(moduleName, program, rootDomNode, flags)
{
	var init = program.init;
	var update = program.update;
	var subscriptions = program.subscriptions;
	var view = program.view;
	var makeRenderer = program.renderer;

	// ambient state
	var managers = {};
	var renderer;

	// init and update state in main process
	var initApp = _elm_lang$core$Native_Scheduler.nativeBinding(function(callback) {
		var results = init(flags);
		var model = results._0;
		renderer = makeRenderer(rootDomNode, enqueue, view(model));
		var cmds = results._1;
		var subs = subscriptions(model);
		dispatchEffects(managers, cmds, subs);
		callback(_elm_lang$core$Native_Scheduler.succeed(model));
	});

	function onMessage(msg, model)
	{
		return _elm_lang$core$Native_Scheduler.nativeBinding(function(callback) {
			var results = A2(update, msg, model);
			model = results._0;
			renderer.update(view(model));
			var cmds = results._1;
			var subs = subscriptions(model);
			dispatchEffects(managers, cmds, subs);
			callback(_elm_lang$core$Native_Scheduler.succeed(model));
		});
	}

	var mainProcess = spawnLoop(initApp, onMessage);

	function enqueue(msg)
	{
		_elm_lang$core$Native_Scheduler.rawSend(mainProcess, msg);
	}

	var ports = setupEffects(managers, enqueue);

	return ports ? { ports: ports } : {};
}
function makeEmbedHelp ( moduleName , program , rootDomNode , flags ) { var init = program . init ; var update = program . update ; var subscriptions = program . subscriptions ; var view = program . view ; var makeRenderer = program . renderer ; // ambient state var managers = { } ; var renderer ; // init and update state in main process var initApp = _elm_lang$core$Native_Scheduler . nativeBinding ( function ( callback ) { var results = init ( flags ) ; var model = results . _0 ; renderer = makeRenderer ( rootDomNode , enqueue , view ( model ) ) ; var cmds = results . _1 ; var subs = subscriptions ( model ) ; dispatchEffects ( managers , cmds , subs ) ; callback ( _elm_lang$core$Native_Scheduler . succeed ( model ) ) ; } ) ; function onMessage ( msg , model ) { return _elm_lang$core$Native_Scheduler . nativeBinding ( function ( callback ) { var results = A2 ( update , msg , model ) ; model = results . _0 ; renderer . update ( view ( model ) ) ; var cmds = results . _1 ; var subs = subscriptions ( model ) ; dispatchEffects ( managers , cmds , subs ) ; callback ( _elm_lang$core$Native_Scheduler . succeed ( model ) ) ; } ) ; } var mainProcess = spawnLoop ( initApp , onMessage ) ; function enqueue ( msg ) { _elm_lang$core$Native_Scheduler . rawSend ( mainProcess , msg ) ; } var ports = setupEffects ( managers , enqueue ) ; return ports ? { ports : ports } : { } ; }
SETUP RUNTIME SYSTEM
SETUP RUNTIME SYSTEM