mirror of
https://github.com/He4eT/cheap-glkote.git
synced 2026-05-05 00:47:28 +00:00
Dirty initial commit
This commit is contained in:
commit
eab87d32a9
13 changed files with 7039 additions and 0 deletions
33
src/index.js
Normal file
33
src/index.js
Normal 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: {}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue