let fs_readFile = util.promisify(fs.readFile)
-let EmailJSCache = function(diag) {
+let EmailJSCache = function(diag1, diag) {
if (!this instanceof EmailJSCache)
- throw Error('EmailJSCache is a constructor')
- this.diag = diag || false
-
- this.build_cache = new BuildCache()
+ throw new Error('EmailJSCache is a constructor')
+ BuildCache.call(this, diag)
+ this.diag1 = diag1
}
-EmailJSCache.prototype.get = function(key) {
- return /*await*/ this.build_cache.get(
- key,
- async result => {
- let text = await fs_readFile(key, {encoding: 'utf-8'})
- result.value = emailjs.server.connect(JSON.parse(text))
- if (this.diag)
- console.log(`opened emailjs client ${key}`)
- }
- )
+EmailJSCache.prototype = Object.create(BuildCache.prototype)
+
+EmailJSCache.prototype.build = async function(key, result) {
+ let text = await fs_readFile(key, {encoding: 'utf-8'})
+ result.value = emailjs.server.connect(JSON.parse(text))
+ if (this.diag1)
+ console.log(`opened emailjs client ${key}`)
}
module.exports = EmailJSCache