Dirty initial commit

This commit is contained in:
He4eT 2021-02-23 12:31:02 +05:00
commit eab87d32a9
13 changed files with 7039 additions and 0 deletions

33
src/index.js Normal file
View file

@ -0,0 +1,33 @@
const FakeDialog = require('./fakeDialog')
const CheapGlkOte = require('./cheapGlkOte')
const noop = () => void null
const noopHandlers = [
'onInit',
'onUpdateContent',
'onDisable',
'onUpdateInputs',
'onFileNameRequest',
'onExit',
'setSend'
].reduce((acc, x) => (acc[x] = noop, acc), {})
module.exports = handlers_ => {
const handlers =
Object.assign({}, noopHandlers, handlers_)
const Dialog = new FakeDialog(handlers)
const GlkOte = new CheapGlkOte(handlers)
const sendFn = GlkOte.sendFn.bind(GlkOte)
return {
sendFn,
glkInterface: {
Dialog,
GlkOte,
Glk: {}
}
}
}