Mercurial > personal > weather-server
comparison weather_server/static/amd/mad.js @ 19:47987502bf4c
Add graph, make it public, and bump the version.
This checks in the tsc-compiled JS files because idklol.
author | Paul Fisher <paul@pfish.zone> |
---|---|
date | Sun, 13 Oct 2019 18:22:06 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
18:9d07dc5c3340 | 19:47987502bf4c |
---|---|
1 "use strict"; | |
2 class MADRegistry { | |
3 constructor() { | |
4 this.mods = new Map(); | |
5 } | |
6 define(name, deps, factory) { | |
7 this.mods.set(name, { deps, factory, exports: null }); | |
8 } | |
9 require(dep, srcMod) { | |
10 if (dep === 'require') { | |
11 return (child) => this.require(child, srcMod); | |
12 } | |
13 if (dep === 'exports') { | |
14 if (!srcMod) | |
15 throw new Error('Internal consistency error.'); | |
16 return srcMod.exports; | |
17 } | |
18 const mod = this.mods.get(dep); | |
19 if (!mod) | |
20 throw new Error('Undefined module.'); | |
21 if (mod.exports) | |
22 return mod.exports; | |
23 mod.exports = {}; | |
24 const deps = mod.deps.map(child => this.require(child, mod)); | |
25 mod.factory(...deps); | |
26 return mod.exports; | |
27 } | |
28 install(to) { | |
29 to['define'] = | |
30 (name, deps, factory) => this.define(name, deps, factory); | |
31 to['require'] = (dep) => this.require(dep); | |
32 } | |
33 } | |
34 //# sourceMappingURL=mad.js.map |