Use a Poll instead of setInterval

pull/6294/head
Jeremy Tuloup 5 years ago
parent cc387c81f2
commit 4e23801285

@ -44,6 +44,7 @@
"@jupyterlab/apputils": "^3.0.0",
"@jupyterlab/docmanager": "^3.0.0",
"@jupyterlab/notebook": "^3.0.0",
"@lumino/polling": "^1.3.3",
"@lumino/widgets": "^1.14.0"
},
"devDependencies": {

@ -20,6 +20,8 @@ import {
IClassicShell
} from '@jupyterlab-classic/application';
import { Poll } from '@lumino/polling';
import { Widget } from '@lumino/widgets';
/**
@ -84,9 +86,16 @@ const checkpoints: JupyterFrontEndPlugin<void> = {
if (classicShell) {
classicShell.currentChanged.connect(onChange);
}
// TODO: replace by a Poll
onChange();
setInterval(onChange, 2000);
new Poll({
auto: true,
factory: () => onChange(),
frequency: {
interval: 2000,
backoff: false
},
standby: 'when-hidden'
});
}
};

Loading…
Cancel
Save