Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move require statements to the beginning #6

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
14 changes: 9 additions & 5 deletions client/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ const Sound = require('./lib/sound.js');
const Matrix = require('./lib/matrix.js');
const {Eye, Plane} = require('./lib/eye.js');

const Lighting = require('./lib/lighting.js');
Kinrany marked this conversation as resolved.
Show resolved Hide resolved
const IconLoader = require('./lib/icon_loader.js');
const Renderer = require('./lib/renderer.js');
const AudioLoader = require('./lib/audio_loader.js');

class BluespessClient extends EventEmitter {
constructor(wsurl, resRoot = "") {
super();
Expand Down Expand Up @@ -36,7 +41,7 @@ class BluespessClient extends EventEmitter {
if(global.AudioContext)
this.audio_ctx = new AudioContext();
}
this.importModule(require('./lib/lighting.js'));
this.importModule(Lighting);
}

handle_login() {
Expand Down Expand Up @@ -315,10 +320,9 @@ BluespessClient.dropdown = function(elem1, elem2, {point = null, autoremove = tr
if(autoremove)
elem2.focus();
};

BluespessClient.prototype.enqueue_icon_meta_load = require('./lib/icon_loader.js');
BluespessClient.prototype.anim_loop = require('./lib/renderer.js');
BluespessClient.prototype.get_audio_buffer = require('./lib/audio_loader.js');
BluespessClient.prototype.enqueue_icon_meta_load = IconLoader;
BluespessClient.prototype.anim_loop = Renderer;
BluespessClient.prototype.get_audio_buffer = AudioLoader;

BluespessClient.Atom = Atom;
BluespessClient.Component = Component;
Expand Down
10 changes: 7 additions & 3 deletions lib/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ const utils = require('./utils.js');
const VisibilityGroup = require('./atom/visgroup.js');
const Dimension = require('./dimension.js');

const Mob = require('./atom/mob.js');
const Lighting = require('./atom/lighting.js');
const Hearer = require('./atom/hearer.js');
Kinrany marked this conversation as resolved.
Show resolved Hide resolved

const _net_tick = Symbol('_net_tick');
const _is_template_processed = Symbol('_is_template_processed');
const _is_server_started = Symbol('_is_server_started');
Expand Down Expand Up @@ -56,9 +60,9 @@ class Bluespess extends EventEmitter {
this.demo_stream = null;

// Import default modules
this.importModule(require('./atom/mob.js'));
this.importModule(require('./atom/lighting.js'));
this.importModule(require('./atom/hearer.js'));
this.importModule(Mob);
this.importModule(Lighting);
this.importModule(Hearer);

this.net_tick_delay = 50;

Expand Down