Fix bug leaking modules into global space, fix unseen missing dependencies due to said bug

This commit is contained in:
Tissevert 2018-12-30 23:33:44 +01:00
parent 559b180a14
commit 52a6d8fc91
4 changed files with 13 additions and 22 deletions

View file

@ -1,4 +1,4 @@
function Automaton(async, cache, dom, messaging, screen, session, ui) { function Automaton(async, dom, messaging, screen, session, ui) {
var menus = { var menus = {
start: { start: {
entries: [ entries: [
@ -56,16 +56,7 @@ function Automaton(async, cache, dom, messaging, screen, session, ui) {
name: 'textSpeed' name: 'textSpeed'
} }
}; };
var areas = new cache.make(function(key) { var game = session.get().game;
messaging.send({tag: 'Load', area: key});
return async.bind(
messaging.receive(function(message) {
return message.tag == 'Area';
}),
function(message) { return async.wrap(message.contents); }
);
});
var game = session.get('game');
if(game != undefined) { if(game != undefined) {
menus.start.entries.unshift( menus.start.entries.unshift(
{label: 'Continue', action: function() { messaging.send({tag: 'Resume', game: game}); }} {label: 'Continue', action: function() { messaging.send({tag: 'Resume', game: game}); }}

View file

@ -1,11 +1,11 @@
window.addEventListener('load', function() { window.addEventListener('load', function() {
messaging = Messaging(); var messaging = Messaging();
async = Async(); var async = Async();
dom = Dom(); var dom = Dom();
screen = Screen(dom); var screen = Screen(dom);
session = Session(async); var session = Session(async, messaging);
cache = Cache(async); var cache = Cache(async);
buttons = Buttons(session); var buttons = Buttons(session);
ui = UI(async, buttons, dom, screen, session); var ui = UI(async, buttons, cache, dom, messaging, screen, session);
automaton = Automaton(async, cache, dom, messaging, screen, session, ui); var automaton = Automaton(async, dom, messaging, screen, session, ui);
}); });

View file

@ -1,4 +1,4 @@
function Session(async) { function Session(async, messaging) {
var session = { var session = {
character: JSON.parse(localStorage.getItem('character')), character: JSON.parse(localStorage.getItem('character')),
game: JSON.parse(localStorage.getItem('game')), game: JSON.parse(localStorage.getItem('game')),

View file

@ -1,4 +1,4 @@
function UI(async, buttons, dom, screen, session) { function UI(async, buttons, cache, dom, messaging, screen, session) {
var lineWidth = 36; var lineWidth = 36;
var textSpeeds = { var textSpeeds = {
slow: 100, slow: 100,