Skip to content

Commit a128df2

Browse files
committed
linting
1 parent 971efb5 commit a128df2

File tree

1 file changed

+27
-32
lines changed

1 file changed

+27
-32
lines changed

src/notebook.ts

Lines changed: 27 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
1-
import {
2-
CodeCell,
3-
CodeCellModel
4-
} from '@jupyterlab/cells';
1+
import { CodeCell, CodeCellModel } from '@jupyterlab/cells';
52
import { NotebookPanel } from '@jupyterlab/notebook';
6-
import {
7-
CellChange,
8-
createMutex,
9-
ISharedCodeCell
10-
} from '@jupyter/ydoc';
3+
import { CellChange, createMutex, ISharedCodeCell } from '@jupyter/ydoc';
114
import { IOutputAreaModel, OutputAreaModel } from '@jupyterlab/outputarea';
125
import { IOutputModel } from '@jupyterlab/rendermime';
136
import { requestAPI } from './handler';
@@ -16,7 +9,6 @@ import { ObservableList } from '@jupyterlab/observables';
169

1710
const globalModelDBMutex = createMutex();
1811

19-
2012
// @ts-ignore
2113
CodeCellModel.prototype._onSharedModelChanged = function (
2214
slot: ISharedCodeCell,
@@ -123,11 +115,10 @@ CodeCellModel.prototype.onOutputsChange = function (
123115
console.debug('Inside onOutputsChange, called with event: ', event);
124116
};
125117

126-
127118
/* A new OutputAreaModel that loads outputs from outputs service */
128-
class RtcOutputAreaModel extends OutputAreaModel implements IOutputAreaModel{
119+
class RtcOutputAreaModel extends OutputAreaModel implements IOutputAreaModel {
129120
constructor(options: IOutputAreaModel.IOptions = {}) {
130-
super({...options, values: []})
121+
super({ ...options, values: [] });
131122
// @ts-ignore
132123
this._trusted = !!options.trusted;
133124
// @ts-ignore
@@ -139,13 +130,13 @@ class RtcOutputAreaModel extends OutputAreaModel implements IOutputAreaModel{
139130
if (options.values) {
140131
// Create an array to store promises for each value
141132
const valuePromises = options.values.map((value, index) => {
142-
console.debug("output #${index}, value: ${value}");
133+
console.debug('output #${index}, value: ${value}');
143134
// @ts-ignore
144135
if (value.metadata?.url) {
145136
// @ts-ignore
146137
return requestAPI(value.metadata.url)
147138
.then(data => {
148-
return data
139+
return data;
149140
})
150141
.catch(error => {
151142
console.error('Error fetching output:', error);
@@ -158,30 +149,34 @@ class RtcOutputAreaModel extends OutputAreaModel implements IOutputAreaModel{
158149
});
159150

160151
// Wait for all promises to resolve and add values in original order
161-
Promise.all(valuePromises)
162-
.then(results => {
163-
console.log("After fetching from outputs service:")
164-
// Add each value in order
165-
results.forEach((data, index) => {
166-
console.debug("output #${index}, data: ${data}");
167-
if(data && !this.isDisposed){
168-
// @ts-ignore
169-
const index = this._add(data) - 1;
170-
const item = this.list.get(index);
171-
// @ts-ignore
172-
item.changed.connect(this._onGenericChange, this);
173-
}
174-
});
152+
Promise.all(valuePromises).then(results => {
153+
console.log('After fetching from outputs service:');
154+
// Add each value in order
155+
results.forEach((data, index) => {
156+
console.debug('output #${index}, data: ${data}');
157+
if (data && !this.isDisposed) {
158+
// @ts-ignore
159+
const index = this._add(data) - 1;
160+
const item = this.list.get(index);
161+
// @ts-ignore
162+
item.changed.connect(this._onGenericChange, this);
163+
}
175164
});
165+
});
176166
}
177167
}
178168
}
179169

180-
CodeCellModel.ContentFactory.prototype.createOutputArea = function(options: IOutputAreaModel.IOptions): IOutputAreaModel {
170+
CodeCellModel.ContentFactory.prototype.createOutputArea = function (
171+
options: IOutputAreaModel.IOptions
172+
): IOutputAreaModel {
181173
return new RtcOutputAreaModel(options);
182-
}
174+
};
183175

184-
export class YNotebookContentFactory extends NotebookPanel.ContentFactory implements NotebookPanel.IContentFactory{
176+
export class YNotebookContentFactory
177+
extends NotebookPanel.ContentFactory
178+
implements NotebookPanel.IContentFactory
179+
{
185180
createCodeCell(options: CodeCell.IOptions): CodeCell {
186181
return new CodeCell(options).initializeState();
187182
}

0 commit comments

Comments
 (0)