mirror of
https://github.com/He4eT/cheap-glkote.git
synced 2026-05-05 00:47:28 +00:00
cheapGlkOte: passing the full input data to onUpdateInputs
This commit is contained in:
parent
df05e82e8b
commit
10891cf269
1 changed files with 21 additions and 35 deletions
|
|
@ -8,35 +8,27 @@ class CheapGlkOte extends GlkOte {
|
||||||
constructor(handlers, loggers, size) {
|
constructor(handlers, loggers, size) {
|
||||||
super(size)
|
super(size)
|
||||||
|
|
||||||
this.current_input_type = null
|
|
||||||
|
|
||||||
this.handlers = handlers
|
this.handlers = handlers
|
||||||
}
|
}
|
||||||
|
|
||||||
sendFn(message, window) {
|
sendFn (message, type, window) {
|
||||||
this.send_response(
|
this.send_response(
|
||||||
this.current_input_type,
|
type,
|
||||||
window,
|
window,
|
||||||
message)
|
message)
|
||||||
this.current_input_type = null
|
|
||||||
}
|
}
|
||||||
|
|
||||||
init(iface) {
|
init (iface) {
|
||||||
this.handlers.onInit()
|
this.handlers.onInit()
|
||||||
super.init(iface)
|
super.init(iface)
|
||||||
}
|
}
|
||||||
|
|
||||||
update_inputs(data) {
|
update_inputs (data) {
|
||||||
if (!data.length) return null
|
if (!data.length) return []
|
||||||
|
this.handlers.onUpdateInputs(data)
|
||||||
const { type } = data[0]
|
|
||||||
if (['char', 'line'].includes(type)) {
|
|
||||||
this.current_input_type = type
|
|
||||||
this.handlers.onUpdateInputs(type)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
accept_specialinput(data) {
|
accept_specialinput (data) {
|
||||||
if (data.type === 'fileref_prompt') {
|
if (data.type === 'fileref_prompt') {
|
||||||
const callback = ref =>
|
const callback = ref =>
|
||||||
this.send_response(
|
this.send_response(
|
||||||
|
|
@ -53,43 +45,37 @@ class CheapGlkOte extends GlkOte {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
update_content(messages) {
|
update_content (messages) {
|
||||||
this.handlers.onUpdateContent(messages)
|
this.handlers.onUpdateContent(messages)
|
||||||
}
|
}
|
||||||
|
|
||||||
exit() {
|
exit () {
|
||||||
this.handlers.onExit()
|
this.handlers.onExit()
|
||||||
super.exit()
|
super.exit()
|
||||||
}
|
}
|
||||||
|
|
||||||
cancel_inputs(data) {
|
cancel_inputs (data) {
|
||||||
if (data.length === 0) {
|
this.handlers.onUpdateInputs(data)
|
||||||
this.current_input_type = null
|
|
||||||
this.handlers.onUpdateInputs(null)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
disable(disable) {
|
disable (data) {
|
||||||
this.disabled = disable
|
this.handlers.onDisable(data)
|
||||||
this.handlers.onDisable(disable)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
update_windows(windows) {
|
update_windows (windows) {
|
||||||
if (windows.length) {
|
this.handlers.onUpdateWindows(windows)
|
||||||
this.handlers.onUpdateWindows(windows)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
log(message) {
|
log (message) {
|
||||||
loggers.log(message)
|
this.loggers.log(message)
|
||||||
}
|
}
|
||||||
|
|
||||||
warning(message) {
|
warning (message) {
|
||||||
loggers.warn(message)
|
this.loggers.warn(message)
|
||||||
}
|
}
|
||||||
|
|
||||||
error(message) {
|
error (message) {
|
||||||
loggers.error(message)
|
this.loggers.error(message)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue