Skip to content

Commit

Permalink
Build with webwindow fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
linev committed Jul 17, 2024
1 parent dc60e10 commit 9970837
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions build/jsroot.js
Original file line number Diff line number Diff line change
Expand Up @@ -121992,9 +121992,9 @@ class WebWindowHandle {
constructor(socket_kind, credits) {
this.kind = socket_kind;
this.state = 0;
this.credits = credits || 10;
this.credits = Math.max(3, credits || 10);
this.cansend = this.credits;
this.ackn = this.credits;
this.ackn = this.credits; // this number will be send to server with first message
this.send_seq = 1; // sequence counter of send messages
this.recv_seq = 0; // sequence counter of received messages
}
Expand Down Expand Up @@ -122426,6 +122426,7 @@ class WebWindowHandle {
this.invokeReceiver(true, 'onWebsocketClosed');
} else if (msg.indexOf('NEW_KEY=') === 0) {
this.new_key = msg.slice(8);
console.log('get new key', this.new_key);
this.storeKeyInUrl();
if (this._ask_reload)
this.askReload(true);
Expand All @@ -122438,7 +122439,7 @@ class WebWindowHandle {
else
this.provideData(chid, msg);

if (this.ackn > 7)
if (this.ackn > Math.max(2, this.credits*0.7))
this.send('READY', 0); // send dummy message to server
};

Expand Down Expand Up @@ -122508,11 +122509,9 @@ class WebWindowHandle {
/** @summary Replace widget URL with new key
* @private */
storeKeyInUrl() {
if (!this._handling_reload)
return;

let href = (typeof document !== 'undefined') ? document.URL : null;
if (isStr(href) && (typeof window !== 'undefined') && window?.history) {

if (this._can_modify_url && isStr(href) && (typeof window !== 'undefined')) {
let prefix = '&key=', p = href.indexOf(prefix);
if (p < 0) {
prefix = '?key=';
Expand All @@ -122522,9 +122521,10 @@ class WebWindowHandle {
const p1 = href.indexOf('#', p+1), p2 = href.indexOf('&', p+1),
pp = (p1 < 0) ? p2 : (p2 < 0 ? p1 : Math.min(p1, p2));
href = href.slice(0, p) + prefix + this.new_key + (pp < 0 ? '' : href.slice(pp));
window.history.replaceState(window.history.state, undefined, href);
window.history?.replaceState(window.history.state, undefined, href);
}
}

if (typeof sessionStorage !== 'undefined') {
sessionStorage.setItem('RWebWindow_SessionKey', sessionKey);
sessionStorage.setItem('RWebWindow_Key', this.new_key);
Expand Down

0 comments on commit 9970837

Please sign in to comment.