Skip to content

Commit

Permalink
Lint
Browse files Browse the repository at this point in the history
  • Loading branch information
jasongrout committed Jul 10, 2021
1 parent 32665c4 commit deeab4d
Show file tree
Hide file tree
Showing 99 changed files with 1,153 additions and 1,187 deletions.
22 changes: 11 additions & 11 deletions examples/web1/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ var WidgetManager = require('./manager').WidgetManager;

require('@jupyter-widgets/controls/css/widgets.css');

document.addEventListener('DOMContentLoaded', function(event) {
document.addEventListener('DOMContentLoaded', function (event) {
var manager = new WidgetManager(document.body);

/**
Expand All @@ -16,20 +16,20 @@ document.addEventListener('DOMContentLoaded', function(event) {
.new_model({
model_module: '@jupyter-widgets/controls',
model_name: widgetType + 'Model',
model_id: 'widget-1'
model_id: 'widget-1',
// Create a view for the model.
})
.then(function(model) {
.then(function (model) {
console.log(widgetType + ' model created');

model.set({
description: description || '',
value: value
value: value,
});

return manager.create_view(model);
}, console.error.bind(console))
.then(function(view) {
.then(function (view) {
console.log(widgetType + ' view created');
manager.display_view(view);
return view;
Expand All @@ -48,26 +48,26 @@ document.addEventListener('DOMContentLoaded', function(event) {
model_id: 'widget-2',
state: {
source: null,
target: null
}
target: null,
},
// Set the link model state.
})
.then(function(link) {
.then(function (link) {
console.log('link created');

return Promise.all([textArea, html]).then(function(models) {
return Promise.all([textArea, html]).then(function (models) {
console.log('setting link');
var textArea = models[0];
var html = models[1];
link.set({
source: [textArea.model, 'value'],
target: [html.model, 'value']
target: [html.model, 'value'],
});
link.save_changes();
console.log('link set');
});
})
.then(function() {
.then(function () {
var event = new Event('widgetsRendered');
document.dispatchEvent(event);
});
Expand Down
8 changes: 4 additions & 4 deletions examples/web1/karma.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Karma configuration
// Generated on Mon Dec 07 2015 08:28:33 GMT-0800 (PST)

module.exports = function(config) {
module.exports = function (config) {
var cfg = {
// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: '',
Expand Down Expand Up @@ -42,8 +42,8 @@ module.exports = function(config) {
customLaunchers: {
Chrome_travis_ci: {
base: 'Chrome',
flags: ['--no-sandbox']
}
flags: ['--no-sandbox'],
},
},

// Continuous Integration mode
Expand All @@ -52,7 +52,7 @@ module.exports = function(config) {

// Concurrency level
// how many browser should be started simultanous
concurrency: Infinity
concurrency: Infinity,
};

if (process.env.TRAVIS) {
Expand Down
10 changes: 5 additions & 5 deletions examples/web1/manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,21 @@ class WidgetManager extends ManagerBase {
}

loadClass(className, moduleName, moduleVersion) {
return new Promise(function(resolve, reject) {
return new Promise(function (resolve, reject) {
if (moduleName === '@jupyter-widgets/controls') {
resolve(controls);
} else if (moduleName === '@jupyter-widgets/base') {
resolve(base);
} else {
var fallback = function(err) {
var fallback = function (err) {
let failedId = err.requireModules && err.requireModules[0];
if (failedId) {
console.log(
`Falling back to jsDelivr for ${moduleName}@${moduleVersion}`
);
window.require(
[
`https://cdn.jsdelivr.net/npm/${moduleName}@${moduleVersion}/dist/index.js`
`https://cdn.jsdelivr.net/npm/${moduleName}@${moduleVersion}/dist/index.js`,
],
resolve,
reject
Expand All @@ -35,7 +35,7 @@ class WidgetManager extends ManagerBase {
};
window.require([`${moduleName}.js`], resolve, fallback);
}
}).then(function(module) {
}).then(function (module) {
if (module[className]) {
return module[className];
} else {
Expand All @@ -48,7 +48,7 @@ class WidgetManager extends ManagerBase {

display_view(view) {
var that = this;
return Promise.resolve(view).then(view => {
return Promise.resolve(view).then((view) => {
LuminoWidget.attach(view.luminoWidget, that.el);
return view;
});
Expand Down
2 changes: 1 addition & 1 deletion examples/web1/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const widgetsRendered = new Promise((resolve, reject) => {
document.addEventListener('widgetsRendered', listener);
});

describe('index.html', function() {
describe('index.html', function () {
this.timeout(10000);

beforeEach(() => {
Expand Down
12 changes: 6 additions & 6 deletions examples/web1/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,21 @@ module.exports = {
output: {
filename: 'index.built.js',
path: path.resolve(__dirname, 'built'),
publicPath: 'built/'
publicPath: 'built/',
},
module: {
rules: [
{ test: /\.css$/, use: ['style-loader', 'css-loader'] },
// jquery-ui loads some images
{ test: /\.(jpg|png|gif)$/, use: 'file-loader' }
]
{ test: /\.(jpg|png|gif)$/, use: 'file-loader' },
],
},
plugins: [
new webpack.DefinePlugin({
// Needed for Blueprint. See https://github.com/palantir/blueprint/issues/4393
'process.env': '{}',
// Needed for various packages using cwd(), like the path polyfill
process: { cwd: () => '/' }
})
]
process: { cwd: () => '/' },
}),
],
};
10 changes: 5 additions & 5 deletions examples/web2/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ var WidgetManager = require('./manager').WidgetManager;
require('@jupyter-widgets/controls/css/widgets.css');
require('font-awesome/css/font-awesome.css');

document.addEventListener('DOMContentLoaded', function(event) {
document.addEventListener('DOMContentLoaded', function (event) {
var code = require('./widget_code.py').default;
var inputarea = document.getElementsByClassName('inputarea')[0];
new CodeMirror(inputarea, {
Expand All @@ -15,20 +15,20 @@ document.addEventListener('DOMContentLoaded', function(event) {
tabSize: 4,
showCursorWhenSelecting: true,
viewportMargin: Infinity,
readOnly: true
readOnly: true,
});

var state = require('./widget_state.json');
var widgetarea = document.getElementsByClassName('widgetarea')[0];
var manager = new WidgetManager(widgetarea);
manager
.set_state(state)
.then(models =>
.then((models) =>
manager.create_view(
models.find(
element => element.model_id == '8621699ecc804983a612f09b7dfe806b'
(element) => element.model_id == '8621699ecc804983a612f09b7dfe806b'
)
)
)
.then(view => manager.display_view(view));
.then((view) => manager.display_view(view));
});
10 changes: 5 additions & 5 deletions examples/web2/manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,21 @@ class WidgetManager extends ManagerBase {
}

loadClass(className, moduleName, moduleVersion) {
return new Promise(function(resolve, reject) {
return new Promise(function (resolve, reject) {
if (moduleName === '@jupyter-widgets/controls') {
resolve(controls);
} else if (moduleName === '@jupyter-widgets/base') {
resolve(base);
} else {
var fallback = function(err) {
var fallback = function (err) {
let failedId = err.requireModules && err.requireModules[0];
if (failedId) {
console.log(
`Falling back to jsDelivr for ${moduleName}@${moduleVersion}`
);
window.require(
[
`https://cdn.jsdelivr.net/npm/${moduleName}@${moduleVersion}/dist/index.js`
`https://cdn.jsdelivr.net/npm/${moduleName}@${moduleVersion}/dist/index.js`,
],
resolve,
reject
Expand All @@ -35,7 +35,7 @@ class WidgetManager extends ManagerBase {
};
window.require([`${moduleName}.js`], resolve, fallback);
}
}).then(function(module) {
}).then(function (module) {
if (module[className]) {
return module[className];
} else {
Expand All @@ -48,7 +48,7 @@ class WidgetManager extends ManagerBase {

display_view(view) {
var that = this;
return Promise.resolve(view).then(function(view) {
return Promise.resolve(view).then(function (view) {
LuminoWidget.attach(view.luminoWidget, that.el);
return view;
});
Expand Down
36 changes: 18 additions & 18 deletions examples/web2/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module.exports = {
output: {
filename: 'index.built.js',
path: path.resolve(__dirname, 'built'),
publicPath: 'built/'
publicPath: 'built/',
},
module: {
rules: [
Expand All @@ -22,29 +22,29 @@ module.exports = {
loader: 'url-loader',
options: {
limit: 10000,
mimetype: 'application/font-woff'
}
}
mimetype: 'application/font-woff',
},
},
},
{
test: /\.woff(\?v=\d+\.\d+\.\d+)?$/,
use: {
loader: 'url-loader',
options: {
limit: 10000,
mimetype: 'application/font-woff'
}
}
mimetype: 'application/font-woff',
},
},
},
{
test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/,
use: {
loader: 'url-loader',
options: {
limit: 10000,
mimetype: 'application/octet-stream'
}
}
mimetype: 'application/octet-stream',
},
},
},
{ test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, use: 'file-loader' },
{
Expand All @@ -53,18 +53,18 @@ module.exports = {
loader: 'url-loader',
options: {
limit: 10000,
mimetype: 'image/svg+xml'
}
}
}
]
mimetype: 'image/svg+xml',
},
},
},
],
},
plugins: [
new webpack.DefinePlugin({
// Needed for Blueprint. See https://github.com/palantir/blueprint/issues/4393
'process.env': '{}',
// Needed for various packages using cwd(), like the path polyfill
process: { cwd: () => '/' }
})
]
process: { cwd: () => '/' },
}),
],
};
14 changes: 5 additions & 9 deletions examples/web3/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,21 @@ import { WidgetManager } from './manager';
import {
KernelManager,
ServerConnection,
KernelMessage
KernelMessage,
} from '@jupyterlab/services';

const BASEURL = prompt('Notebook BASEURL', 'http://localhost:8888');
if (BASEURL === null) {
alert('A base URL is needed to run the example!');
throw new Error('A base URL is needed to run the example!');
}
const WSURL =
'ws:' +
BASEURL.split(':')
.slice(1)
.join(':');
const WSURL = 'ws:' + BASEURL.split(':').slice(1).join(':');

document.addEventListener('DOMContentLoaded', async function(event) {
document.addEventListener('DOMContentLoaded', async function (event) {
// Connect to the notebook webserver.
const connectionInfo = ServerConnection.makeSettings({
baseUrl: BASEURL!,
wsUrl: WSURL
wsUrl: WSURL,
});
const kernelManager = new KernelManager({ serverSettings: connectionInfo });
const kernel = await kernelManager.startNew();
Expand All @@ -41,7 +37,7 @@ document.addEventListener('DOMContentLoaded', async function(event) {
tabSize: 4,
showCursorWhenSelecting: true,
viewportMargin: Infinity,
readOnly: true
readOnly: true,
});

// Create the widget area and widget manager
Expand Down
2 changes: 1 addition & 1 deletion examples/web3/src/manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export class WidgetManager extends HTMLManager {
_get_comm_info(): Promise<any> {
return this.kernel
.requestCommInfo({ target_name: this.comm_target_name })
.then(reply => (reply.content as any).comms);
.then((reply) => (reply.content as any).comms);
}

kernel: Kernel.IKernelConnection;
Expand Down
Loading

0 comments on commit deeab4d

Please sign in to comment.