-
Notifications
You must be signed in to change notification settings - Fork 16
/
Dia.js
40 lines (30 loc) · 928 Bytes
/
Dia.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
if (process.env.NODE_ENV != 'test') {
console.log (new Date ().toString (), "Dia.js is loading...")
}
require ('./H4xx.js')
reExport ('ModuleTools')
this.Handler = require ('./Content/Handler.js')
this.HTTP = require ('./Content/Handler/HTTP.js')
this.DB = require ('./DB.js')
this.Cache = require ('./Cache.js')
this.Config = require ('./Config.js')
this.Logger = require ('./Log/ConsoleLogger.js')
function reExport (module_name) {
try {
var m = require ('./' + module_name + '.js')
for (var i in m) exports [i] = m [i]
}
catch (x) {
suicide (x)
}
}
this.factory = class {
constructor (clazz, o = {}) {
let {check_options} = clazz.prototype; if (check_options) check_options (o)
this.clazz = clazz
this.o = o
}
async acquire (o) {
return new (this.clazz) ({...this.o, ...o})
}
}