Mercurial > personal > weather-server
view weather_server/static/amd/mad.js @ 21:beb42c835c52
Make weather server handle arbitrary data:
- Make logfile record arbitrary BSONs
- Make server handlers OK with same
- Make location type a normal class rather than attrs;
have it handle its own logger.
- Bump version number.
author | Paul Fisher <paul@pfish.zone> |
---|---|
date | Sat, 19 Oct 2019 18:40:48 -0400 |
parents | 47987502bf4c |
children |
line wrap: on
line source
"use strict"; class MADRegistry { constructor() { this.mods = new Map(); } define(name, deps, factory) { this.mods.set(name, { deps, factory, exports: null }); } require(dep, srcMod) { if (dep === 'require') { return (child) => this.require(child, srcMod); } if (dep === 'exports') { if (!srcMod) throw new Error('Internal consistency error.'); return srcMod.exports; } const mod = this.mods.get(dep); if (!mod) throw new Error('Undefined module.'); if (mod.exports) return mod.exports; mod.exports = {}; const deps = mod.deps.map(child => this.require(child, mod)); mod.factory(...deps); return mod.exports; } install(to) { to['define'] = (name, deps, factory) => this.define(name, deps, factory); to['require'] = (dep) => this.require(dep); } } //# sourceMappingURL=mad.js.map