Mercurial > personal > weather-server
view weather_server/static/amd/mad.js @ 24:20c8ec56e447
logfile: Pull logfile thread out of Logger.
This enables automatic garbage collection of Logger instances,
since a running thread no longer has a reference to a Logger's self.
It separates exclusive management of logfile state into the
_writer_thread function, which now opens the file and writes it until
it is told to stop by receiving the poison pill.
author | Paul Fisher <paul@pfish.zone> |
---|---|
date | Sun, 10 Nov 2019 23:07:11 -0500 |
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