mirror of https://github.com/anoshenko/rui.git
23 lines
394 B
JavaScript
23 lines
394 B
JavaScript
|
|
async function sendMessage(message) {
|
|
const response = await fetch('/', {
|
|
method : 'POST',
|
|
body : message,
|
|
"Content-Type" : "text/plain",
|
|
});
|
|
|
|
const text = await response.text();
|
|
if (text != "") {
|
|
window.eval(text)
|
|
}
|
|
}
|
|
|
|
window.onload = function() {
|
|
sendMessage( sessionInfo() );
|
|
}
|
|
|
|
window.onfocus = function() {
|
|
windowFocus = true
|
|
sendMessage( "session-resume{}" );
|
|
}
|