Skip to content

Commit ca50f1a

Browse files
authored
Merge pull request #3097 from gnestor/requirejs
[WIP] Use `requirejs` vs. `require`
2 parents 946fa40 + 4d258a8 commit ca50f1a

File tree

14 files changed

+24
-24
lines changed

14 files changed

+24
-24
lines changed

notebook/static/base/js/events.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// before all other objects so it exists when others register event handlers.
66
// To register an event handler:
77
//
8-
// require(['base/js/events'], function (events) {
8+
// requirejs(['base/js/events'], function (events) {
99
// events.on("event.Namespace", function () { do_stuff(); });
1010
// });
1111

notebook/static/base/js/namespace.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ var Jupyter = Jupyter || {};
77
var jprop = function(name, module_path){
88
Object.defineProperty(Jupyter, name, {
99
get: function() {
10-
console.warn('accessing `'+name+'` is deprecated. Use `require("'+module_path+'")`');
11-
return require(module_path);
10+
console.warn('accessing `'+name+'` is deprecated. Use `requirejs("'+module_path+'")`');
11+
return requirejs(module_path);
1212
},
1313
enumerable: true,
1414
configurable: false
@@ -18,8 +18,8 @@ var jprop = function(name, module_path){
1818
var jglobal = function(name, module_path){
1919
Object.defineProperty(Jupyter, name, {
2020
get: function() {
21-
console.warn('accessing `'+name+'` is deprecated. Use `require("'+module_path+'").'+name+'`');
22-
return require(module_path)[name];
21+
console.warn('accessing `'+name+'` is deprecated. Use `requirejs("'+module_path+'").'+name+'`');
22+
return requirejs(module_path)[name];
2323
},
2424
enumerable: true,
2525
configurable: false

notebook/static/bidi/bidi.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ define(['bidi/numericshaping'], function(numericshaping) {
1515
document.body.dir = 'rtl';
1616
}
1717

18-
require(['moment'], function (moment) {
18+
requirejs(['moment'], function (moment) {
1919
console.log('Loaded moment locale', moment.locale(_uiLang()));
2020
});
2121

notebook/static/custom/custom.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
* 'base/js/events'
6262
* ], function(events) {
6363
* events.on('app_initialized.DashboardApp', function(){
64-
* require(['custom/unofficial_extension.js'])
64+
* requirejs(['custom/unofficial_extension.js'])
6565
* });
6666
* });
6767
*

notebook/static/edit/js/main.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright (c) Jupyter Development Team.
22
// Distributed under the terms of the Modified BSD License.
33

4-
require([
4+
requirejs([
55
'jquery',
66
'contents',
77
'base/js/namespace',

notebook/static/notebook/js/about.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Copyright (c) Jupyter Development Team.
22
// Distributed under the terms of the Modified BSD License.
3-
require([
3+
requirejs([
44
'jquery',
55
'base/js/dialog',
66
'base/js/i18n',

notebook/static/notebook/js/actions.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ define([
3636
Object.seal(this);
3737
};
3838

39-
var $ = require('jquery');
40-
var events = require('base/js/events');
39+
var $ = requirejs('jquery');
40+
var events = requirejs('base/js/events');
4141

4242
/**
4343
* A bunch of predefined `Simple Actions` used by Jupyter.

notebook/static/notebook/js/codemirror-ipython.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55

66
(function(mod) {
77
if (typeof exports == "object" && typeof module == "object"){ // CommonJS
8-
mod(require("codemirror/lib/codemirror"),
9-
require("codemirror/mode/python/python")
8+
mod(requirejs("codemirror/lib/codemirror"),
9+
requirejs("codemirror/mode/python/python")
1010
);
1111
} else if (typeof define == "function" && define.amd){ // AMD
1212
define(["codemirror/lib/codemirror",

notebook/static/notebook/js/codemirror-ipythongfm.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99

1010
(function(mod) {
1111
if (typeof exports == "object" && typeof module == "object"){ // CommonJS
12-
mod(require("codemirror/lib/codemirror")
13-
,require("codemirror/addon/mode/multiplex")
14-
,require("codemirror/mode/gfm/gfm")
15-
,require("codemirror/mode/stex/stex")
12+
mod(requirejs("codemirror/lib/codemirror")
13+
,requirejs("codemirror/addon/mode/multiplex")
14+
,requirejs("codemirror/mode/gfm/gfm")
15+
,requirejs("codemirror/mode/stex/stex")
1616
);
1717
} else if (typeof define == "function" && define.amd){ // AMD
1818
define(["codemirror/lib/codemirror"

notebook/static/notebook/js/main.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ var bind = function bind(obj) {
2020
Function.prototype.bind = Function.prototype.bind || bind ;
2121

2222

23-
require([
23+
requirejs([
2424
'jquery',
2525
'contents',
2626
'base/js/namespace',

notebook/static/notebook/js/maintoolbar.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ define([
77
'./toolbar',
88
'./celltoolbar',
99
'base/js/i18n'
10-
], function($, require, toolbar, celltoolbar, i18n) {
10+
], function($, requirejs, toolbar, celltoolbar, i18n) {
1111
"use strict";
1212

1313
var MainToolBar = function (selector, options) {

notebook/static/services/contents.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
// Copyright (c) Jupyter Development Team.
22
// Distributed under the terms of the Modified BSD License.
33

4-
define(function(require) {
4+
define(function(requirejs) {
55
"use strict";
66

7-
var $ = require('jquery');
8-
var utils = require('base/js/utils');
7+
var $ = requirejs('jquery');
8+
var utils = requirejs('base/js/utils');
99

1010
var Contents = function(options) {
1111
/**

notebook/static/terminal/js/main.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright (c) Jupyter Development Team.
22
// Distributed under the terms of the Modified BSD License.
33

4-
require([
4+
requirejs([
55
'jquery',
66
'base/js/utils',
77
'base/js/page',

notebook/static/tree/js/main.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ var bind = function bind(obj) {
2020
Function.prototype.bind = Function.prototype.bind || bind ;
2121

2222

23-
require([
23+
requirejs([
2424
'jquery',
2525
'contents',
2626
'base/js/namespace',

0 commit comments

Comments
 (0)