mirror of
https://github.com/liamcottle/reticulum-meshchat.git
synced 2026-12-03 21:30:03 -05:00
fix composing new message and unmounting listeners
This commit is contained in:
parent
ec63939b7c
commit
68df149c82
5 changed files with 85 additions and 54 deletions
|
|
@ -10,6 +10,16 @@ class DialogUtils {
|
|||
}
|
||||
}
|
||||
|
||||
static async prompt(message) {
|
||||
if(window.electron){
|
||||
// running inside electron, use ipc prompt
|
||||
return await window.electron.prompt(message);
|
||||
} else {
|
||||
// running inside normal browser, use browser prompt
|
||||
return window.prompt(message);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export default DialogUtils;
|
||||
|
|
|
|||
26
src/frontend/js/GlobalEmitter.js
Normal file
26
src/frontend/js/GlobalEmitter.js
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
import mitt from 'mitt';
|
||||
|
||||
class GlobalEmitter {
|
||||
|
||||
constructor() {
|
||||
this.emitter = mitt();
|
||||
}
|
||||
|
||||
// add event listener
|
||||
on(event, handler) {
|
||||
this.emitter.on(event, handler);
|
||||
}
|
||||
|
||||
// remove event listener
|
||||
off(event, handler) {
|
||||
this.emitter.off(event, handler);
|
||||
}
|
||||
|
||||
// emit event
|
||||
emit(type, event) {
|
||||
this.emitter.emit(type, event);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export default new GlobalEmitter();
|
||||
Loading…
Add table
Add a link
Reference in a new issue