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 = {
start: {
entries: [
@ -56,16 +56,7 @@ function Automaton(async, cache, dom, messaging, screen, session, ui) {
name: 'textSpeed'
}
};
var areas = new cache.make(function(key) {
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');
var game = session.get().game;
if(game != undefined) {
menus.start.entries.unshift(
{label: 'Continue', action: function() { messaging.send({tag: 'Resume', game: game}); }}

View file

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

View file

@ -1,4 +1,4 @@
function Session(async) {
function Session(async, messaging) {
var session = {
character: JSON.parse(localStorage.getItem('character')),
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 textSpeeds = {
slow: 100,