Abstract Confine Runtime
The base class for confine runtimes.
npm i abstract-confine-runtime
Example usage:
const fs = require('fs')
const { AbstractConfineRuntime, APIDescription, APIObject, APIMethod, MethodNotFound } = require('abstract-confine-runtime')
module.exports = class MyConfineRuntime extends AbstractConfineRuntime {
constructor (opts) {
super(opts)
}
async init () {
this.myCustomProcess.on('closed', () => {
this.emit('closed', exitCode)
})
}
async run () {
}
async close () {
}
configure (opts) {
}
describeAPI () {
return new APIDescription()
}
async handleAPICall (methodName, params) {
throw new MethodNotFound()
}
}
The describeAPI()
method needs to provide a tree of APIDescription
, APIObject
, and APIMethod
objects, like so:
return new APIDescription([
new APIMethod('hello'),
new APIObject('sub', [
new APIMethod('method')
]),
new APIMethod('zed')
])
License
MIT