Skip to content

Commit 4b37d26

Browse files
author
Stephen Brennan
committed
Use IPython config object rather than loading our own.
1 parent 1f4d660 commit 4b37d26

File tree

2 files changed

+7
-21
lines changed

2 files changed

+7
-21
lines changed

src/jupyter_contrib_nbextensions/nbextensions/notify/notify.js

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -11,29 +11,13 @@ Add this file to $(ipython locate)/nbextensions/
1111
define([
1212
"jquery",
1313
"base/js/namespace",
14-
"base/js/utils",
15-
"services/config",
16-
], function ($, IPython, utils, configmod) {
14+
], function ($, IPython) {
1715
"use strict";
1816

1917
var params = {
2018
sticky: false
2119
};
2220

23-
var base_url = utils.get_body_data("baseUrl");
24-
var config = new configmod.ConfigSection('notebook', {base_url: base_url});
25-
26-
var update_params = function() {
27-
for (var key in params) {
28-
if (config.data.hasOwnProperty(key)) {
29-
params[key] = config.data[key];
30-
}
31-
}
32-
}
33-
config.loaded.then(function() {
34-
update_params();
35-
})
36-
3721
var current_time = function() {
3822
return new Date().getTime() / 1000;
3923
};
@@ -181,9 +165,11 @@ define([
181165
};
182166

183167
var load_ipython_extension = function () {
184-
config.load();
185-
ensure_permission();
186-
setup_notifier();
168+
return Jupyter.notebook.config.loaded.then(function() {
169+
$.extend(true, params, Jupyter.notebook.config.data.notify);
170+
ensure_permission();
171+
setup_notifier();
172+
});
187173
};
188174

189175
return {

src/jupyter_contrib_nbextensions/nbextensions/notify/notify.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Icon: notification.png
88
Main: notify.js
99
Compatibility: 4.x, 5.x
1010
Parameters:
11-
- name: sticky
11+
- name: notify.sticky
1212
description: Require interactions on notifications to dismiss them.
1313
input_type: checkbox
1414
default: false

0 commit comments

Comments
 (0)