package re-organization

This commit is contained in:
Stewart Allen 2021-12-28 16:38:05 -05:00
commit 678316ac95
98 changed files with 63 additions and 62 deletions

View file

@ -4,10 +4,10 @@
(function() {
let moto = self.moto = self.moto || {};
if (moto.IDB) return;
let data = self.data = self.data || {};
if (data.Index) return;
moto.IDB = moto.Storage = Storage;
data.Index = IDBStore;
// https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API
@ -25,7 +25,7 @@
* @param {number} [version]
* @constructor
*/
function Storage(dbname, options = {}) {
function IDBStore(dbname, options = {}) {
this.db = null;
this.name = dbname;
this.stores = options.stores || [ dbname ];
@ -35,11 +35,11 @@
this.initCalled = false;
}
Storage.delete = function(dbname) {
IDBStore.delete = function(dbname) {
IDB.deleteDatabase(dbname);
};
let SP = Storage.prototype;
let SP = IDBStore.prototype;
/** ******************************************************************
* indexedDB implementation

View file

@ -4,15 +4,15 @@
(function() {
let moto = self.moto = self.moto || {};
if (moto.KV) return;
let data = self.data = self.data || {};
if (data.Local) return;
function KV() {
function Local() {
this.__data__ = {};
this.__mem__ = true;
}
var KP = KV.prototype;
var KP = Local.prototype;
KP.getItem = function(key) {
return this[key];
@ -32,13 +32,13 @@
};
try {
let KV = moto.KV = self.localStorage,
let local = data.Local = self.localStorage,
testkey = '__test';
KV.setItem(testkey, 1);
KV.getItem(testkey);
KV.removeItem(testkey);
local.setItem(testkey, 1);
local.getItem(testkey);
local.removeItem(testkey);
} catch (e) {
moto.KV = new KV();
data.Local = new Local();
let msg = "in private or restricted browsing mode. local storage blocked. application may not function properly.";
console.log(msg);
alert(msg);

View file

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 2 KiB

After

Width:  |  Height:  |  Size: 2 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

Before After
Before After

View file

@ -5,6 +5,7 @@
(function () {
let MOTO = self.moto,
DATA = self.data,
KIRI = self.kiri,
LOAD = self.load,
BASE = self.base,
@ -18,9 +19,9 @@
SECURE = isSecure(LOC.protocol),
LOCAL = self.debug && !SETUP.remote,
EVENT = KIRI.broker,
SDB = MOTO.KV,
ODB = KIRI.odb = new MOTO.Storage(SETUP.d ? SETUP.d[0] : 'kiri'),
// K3DB = KIRI.wdb = new MOTO.Storage('kiri3', { stores:["file","work"] }).init(),
SDB = DATA.Local,
ODB = KIRI.odb = new DATA.Index(SETUP.d ? SETUP.d[0] : 'kiri'),
// K3DB = KIRI.wdb = new DATA.Index('kiri3', { stores:["file","work"] }).init(),
SPACE = KIRI.space = MOTO.Space,
WIDGETS = KIRI.widgets = [],
CATALOG = KIRI.catalog = KIRI.openCatalog(ODB),

View file

@ -14,7 +14,7 @@
};
const AP = Ajax.prototype,
KV = moto.KV,
KV = data.Local,
KEY = "moto-ajax",
TIME = function() { return new Date().getTime() },
MOKEY = moto.id = KV.getItem(KEY) || (TIME().toString(36)+rnd()+rnd());

View file

@ -8,7 +8,7 @@ let MOTO = self.moto = self.moto || {};
* Adapted from THREE.OrbitControls
*/
MOTO.CTRL = function (object, domElement, notify, slider) {
MOTO.Orbit = function (object, domElement, notify, slider) {
this.object = object;
this.domElement = ( domElement !== undefined ) ? domElement : document;
@ -620,4 +620,4 @@ MOTO.CTRL = function (object, domElement, notify, slider) {
window.addEventListener('keydown', onKeyDown, false);
};
MOTO.CTRL.prototype = Object.create(THREE.EventDispatcher.prototype);
MOTO.Orbit.prototype = Object.create(THREE.EventDispatcher.prototype);

View file

@ -1089,7 +1089,7 @@
raycaster = new THREE.Raycaster();
viewControl = new MOTO.CTRL(camera, domelement, (position, moved) => {
viewControl = new MOTO.Orbit(camera, domelement, (position, moved) => {
if (platform) {
platform.visible = hidePlatformBelow ?
initialized && position.y >= 0 && showPlatform : showPlatform;