add gapp dependency, start annotating files accordingly

This commit is contained in:
Stewart Allen 2021-12-29 00:19:22 -05:00
commit 6eb7aa3897
22 changed files with 114 additions and 39 deletions

View file

@ -4,6 +4,8 @@
(function() {
gapp.register('moto.ajax');
let moto = self.moto = self.moto || {};
if (moto.Ajax) return;

View file

@ -1,6 +1,15 @@
/** Copyright Stewart Allen <sa@grid.space> -- All Rights Reserved */
"use strict";
(function() {
if (gapp.broker) return;
class Broker {
constructor() {
this.topics = {};
this.used = {};
}
topics() {
@ -51,6 +60,9 @@ class Broker {
if (topic !== ".topic.publish") {
this.publish(".topic.publish", {topic, message, options});
}
// store last seen message on a topic
// acts as a tracker for all used topics
this.used[topic] = message;
let channel = this.topics[topic];
if (channel && channel.length) {
for (let listener of channel) {
@ -61,6 +73,8 @@ class Broker {
setTimeout(() => { throw e }, 1);
}
}
} else if (topic.indexOf(".topic.") < 0) {
dbug.debug(`undelivered '${topic}'`, message);
}
}
@ -73,8 +87,7 @@ class Broker {
}
}
// establish default broker when GridApp container present
let gapp = self.gapp;
if (gapp && !gapp.broker) {
gapp.broker = new Broker();
}
gapp.broker = new Broker();
gapp.register('moto.broker');
})();

View file

@ -4,8 +4,7 @@
(function() {
let gapp = self.gapp = self.gapp || {},
moto = self.moto = self.moto || gapp,
let moto = self.moto = self.moto || {},
ccvalue = self.navigator ? navigator.hardwareConcurrency || 1 : 1,
ccmax = ccvalue > 3 ? ccvalue - 1 : 0,
workcc = false, // concurrent or not
@ -16,6 +15,8 @@ let gapp = self.gapp = self.gapp || {},
if (moto.client) return;
gapp.register('moto.client');
// code is running in the browser / client context
let client = moto.client = {

View file

@ -2,8 +2,12 @@
"use strict";
(function() {
let MOTO = self.moto = self.moto || {};
gapp.register('moto.orbit');
/**
* Adapted from THREE.OrbitControls
*/
@ -621,3 +625,5 @@ MOTO.Orbit = function (object, domElement, notify, slider) {
};
MOTO.Orbit.prototype = Object.create(THREE.EventDispatcher.prototype);
})();

View file

@ -3,6 +3,7 @@
"use strict";
(function() {
gapp.register('moto.space');
let MOTO = self.moto = self.moto || {},
WIN = window,

View file

@ -4,13 +4,11 @@
(function() {
let gapp = self.gapp = self.gapp || {},
moto = self.moto = self.moto || gapp;
let moto = self.moto = self.moto || {};
if (moto.worker) return;
// allow license to inject module
self.gapp = self.gapp || moto;
gapp.register('moto.worker');
let endpoints = {};