Skip to content

Commit

Permalink
Lint
Browse files Browse the repository at this point in the history
  • Loading branch information
martinRenou committed Dec 20, 2021
1 parent 8cd56b3 commit 781002b
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions packages/voila/src/manager.ts
Expand Up @@ -216,16 +216,18 @@ export class WidgetManager extends JupyterLabManager {
initComm.on_msg(msg => {
data = msg['content']['data'];

if (data.method != 'update_states') {
console.warn(`Unknown ${data.method} message on the Control channel`);
if (data.method !== 'update_states') {
console.warn(`
Unknown ${data.method} message on the Control channel
`);
return;
}

buffers = (msg.buffers || []).map((b: any) => {
if (b instanceof DataView) {
return b;
return b;
} else {
return new DataView(b instanceof ArrayBuffer ? b : b.buffer);
return new DataView(b instanceof ArrayBuffer ? b : b.buffer);
}
});

Expand All @@ -235,11 +237,12 @@ export class WidgetManager extends JupyterLabManager {
initComm.on_close(reject);

// Send a states request msg
initComm.send({method: 'request_states'}, {});
initComm.send({ method: 'request_states' }, {});
});
}
catch {
console.warn('Failed to open "jupyter.widget.control" comm channel, fallback to slow fetching of widgets.');
} catch {
console.warn(
'Failed to open "jupyter.widget.control" comm channel, fallback to slow fetching of widgets.'
);
// Fallback to the old implementation for old ipywidgets versions (<=7.6)
return this._build_models_slow();
}
Expand All @@ -256,7 +259,7 @@ export class WidgetManager extends JupyterLabManager {
bufferPaths[bufferPath[0]] = [];
}
bufferPaths[bufferPath[0]].push(bufferPath.slice(1));
};
}

const widgetPromises: Promise<base.WidgetModel>[] = [];

Expand All @@ -270,7 +273,11 @@ export class WidgetManager extends JupyterLabManager {
// Put binary buffers
if (widget_id in bufferPaths) {
const nBuffers = bufferPaths[widget_id].length;
base.put_buffers(state, bufferPaths[widget_id], buffers.slice(0, nBuffers));
base.put_buffers(
state,
bufferPaths[widget_id],
buffers.slice(0, nBuffers)
);
buffers = buffers.slice(nBuffers);
}

Expand Down

0 comments on commit 781002b

Please sign in to comment.