-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #105 from jasongrout/es6
Update to es6 modules and more modern js syntax
- Loading branch information
Showing
7 changed files
with
34 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
// In an AMD module, we set the public path using the magic requirejs 'module' dependency | ||
// See https://github.com/requirejs/requirejs/wiki/Differences-between-the-simplified-CommonJS-wrapper-and-standard-AMD-define#module | ||
// Since 'module' is a requirejs magic module, we must include 'module' in the webpack externals configuration. | ||
var module = require('module'); | ||
var url = new URL(module.uri, document.location) | ||
import * as module from 'module'; | ||
const url = new URL(module.uri, document.location) | ||
// Using lastIndexOf('/')+1 gives us the empty string if there is no '/', so pathname becomes '/' | ||
url.pathname = url.pathname.slice(0,url.pathname.lastIndexOf('/')+1); | ||
__webpack_public_path__ = `${url.origin}${url.pathname}`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
// Export widget models and views, and the npm package version number. | ||
module.exports = require('./example.js'); | ||
module.exports['version'] = require('../package.json').version; | ||
|
||
export {HelloModel, HelloView} from './example'; | ||
export {version} from '../package.json'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,17 @@ | ||
var plugin = require('./index'); | ||
var base = require('@jupyter-widgets/base'); | ||
import {HelloModel, HelloView, version} from './index'; | ||
import {IJupyterWidgetRegistry} from '@jupyter-widgets/base'; | ||
|
||
module.exports = { | ||
export const helloWidgetPlugin = { | ||
id: '{{ cookiecutter.npm_package_name }}:plugin', | ||
requires: [base.IJupyterWidgetRegistry], | ||
requires: [IJupyterWidgetRegistry], | ||
activate: function(app, widgets) { | ||
widgets.registerWidget({ | ||
name: '{{ cookiecutter.npm_package_name }}', | ||
version: plugin.version, | ||
exports: plugin | ||
version: version, | ||
exports: { HelloModel, HelloView } | ||
}); | ||
}, | ||
autoStart: true | ||
}; | ||
|
||
export default helloWidgetPlugin; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters