Skip to content

Commit

Permalink
init() should be backwards compat with older API
Browse files Browse the repository at this point in the history
Ref jupyter#196

(c) Copyright IBM Corp. 2016
  • Loading branch information
jhpedemonte committed Mar 8, 2016
1 parent 4d0f5f6 commit 1ab1213
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion nb-extension/js/init/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,16 @@ define([
}

return function(config) {
var baseURL;
if (typeof config === 'string') {
// backwards compatibility with old API, which took `baseURL` as first argument and
// optional `config` as second arg
baseURL = config;
config = arguments[1] || {};
} else {
baseURL = config.IPython ? config.IPython.notebook.base_url : '/';
}

// if we are not in Jupyter notebook, need to create shims for compatibility
if (!config.IPython) {
shimIPython(config);
Expand All @@ -176,7 +186,6 @@ define([
// expose suppressErrors, false by default to display errors
window.Urth.suppressErrors = config.suppressErrors;

var baseURL = config.IPython ? config.IPython.notebook.base_url : '/';
isServerExtensionAvailable(baseURL + COMPONENTS_DIR, function(isAvailable){
console.log('Server extension is ' + (isAvailable ? '' : 'NOT ') + 'available!');

Expand Down

0 comments on commit 1ab1213

Please sign in to comment.