Skip to content

Commit

Permalink
Use requirejs vs. require
Browse files Browse the repository at this point in the history
  • Loading branch information
gnestor committed Nov 30, 2017
1 parent ee419c0 commit 4d258a8
Show file tree
Hide file tree
Showing 14 changed files with 24 additions and 24 deletions.
2 changes: 1 addition & 1 deletion notebook/static/base/js/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// before all other objects so it exists when others register event handlers.
// To register an event handler:
//
// require(['base/js/events'], function (events) {
// requirejs(['base/js/events'], function (events) {
// events.on("event.Namespace", function () { do_stuff(); });
// });

Expand Down
8 changes: 4 additions & 4 deletions notebook/static/base/js/namespace.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ var Jupyter = Jupyter || {};
var jprop = function(name, module_path){
Object.defineProperty(Jupyter, name, {
get: function() {
console.warn('accessing `'+name+'` is deprecated. Use `require("'+module_path+'")`');
return require(module_path);
console.warn('accessing `'+name+'` is deprecated. Use `requirejs("'+module_path+'")`');
return requirejs(module_path);
},
enumerable: true,
configurable: false
Expand All @@ -18,8 +18,8 @@ var jprop = function(name, module_path){
var jglobal = function(name, module_path){
Object.defineProperty(Jupyter, name, {
get: function() {
console.warn('accessing `'+name+'` is deprecated. Use `require("'+module_path+'").'+name+'`');
return require(module_path)[name];
console.warn('accessing `'+name+'` is deprecated. Use `requirejs("'+module_path+'").'+name+'`');
return requirejs(module_path)[name];
},
enumerable: true,
configurable: false
Expand Down
2 changes: 1 addition & 1 deletion notebook/static/bidi/bidi.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ define(['bidi/numericshaping'], function(numericshaping) {
document.body.dir = 'rtl';
}

require(['moment'], function (moment) {
requirejs(['moment'], function (moment) {
console.log('Loaded moment locale', moment.locale(_uiLang()));
});

Expand Down
2 changes: 1 addition & 1 deletion notebook/static/custom/custom.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
* 'base/js/events'
* ], function(events) {
* events.on('app_initialized.DashboardApp', function(){
* require(['custom/unofficial_extension.js'])
* requirejs(['custom/unofficial_extension.js'])
* });
* });
*
Expand Down
2 changes: 1 addition & 1 deletion notebook/static/edit/js/main.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.

require([
requirejs([
'jquery',
'contents',
'base/js/namespace',
Expand Down
2 changes: 1 addition & 1 deletion notebook/static/notebook/js/about.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
require([
requirejs([
'jquery',
'base/js/dialog',
'base/js/i18n',
Expand Down
4 changes: 2 additions & 2 deletions notebook/static/notebook/js/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ define([
Object.seal(this);
};

var $ = require('jquery');
var events = require('base/js/events');
var $ = requirejs('jquery');
var events = requirejs('base/js/events');

/**
* A bunch of predefined `Simple Actions` used by Jupyter.
Expand Down
4 changes: 2 additions & 2 deletions notebook/static/notebook/js/codemirror-ipython.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

(function(mod) {
if (typeof exports == "object" && typeof module == "object"){ // CommonJS
mod(require("codemirror/lib/codemirror"),
require("codemirror/mode/python/python")
mod(requirejs("codemirror/lib/codemirror"),
requirejs("codemirror/mode/python/python")
);
} else if (typeof define == "function" && define.amd){ // AMD
define(["codemirror/lib/codemirror",
Expand Down
8 changes: 4 additions & 4 deletions notebook/static/notebook/js/codemirror-ipythongfm.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@

(function(mod) {
if (typeof exports == "object" && typeof module == "object"){ // CommonJS
mod(require("codemirror/lib/codemirror")
,require("codemirror/addon/mode/multiplex")
,require("codemirror/mode/gfm/gfm")
,require("codemirror/mode/stex/stex")
mod(requirejs("codemirror/lib/codemirror")
,requirejs("codemirror/addon/mode/multiplex")
,requirejs("codemirror/mode/gfm/gfm")
,requirejs("codemirror/mode/stex/stex")
);
} else if (typeof define == "function" && define.amd){ // AMD
define(["codemirror/lib/codemirror"
Expand Down
2 changes: 1 addition & 1 deletion notebook/static/notebook/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ var bind = function bind(obj) {
Function.prototype.bind = Function.prototype.bind || bind ;


require([
requirejs([
'jquery',
'contents',
'base/js/namespace',
Expand Down
2 changes: 1 addition & 1 deletion notebook/static/notebook/js/maintoolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ define([
'./toolbar',
'./celltoolbar',
'base/js/i18n'
], function($, require, toolbar, celltoolbar, i18n) {
], function($, requirejs, toolbar, celltoolbar, i18n) {
"use strict";

var MainToolBar = function (selector, options) {
Expand Down
6 changes: 3 additions & 3 deletions notebook/static/services/contents.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.

define(function(require) {
define(function(requirejs) {
"use strict";

var $ = require('jquery');
var utils = require('base/js/utils');
var $ = requirejs('jquery');
var utils = requirejs('base/js/utils');

var Contents = function(options) {
/**
Expand Down
2 changes: 1 addition & 1 deletion notebook/static/terminal/js/main.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.

require([
requirejs([
'jquery',
'base/js/utils',
'base/js/page',
Expand Down
2 changes: 1 addition & 1 deletion notebook/static/tree/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ var bind = function bind(obj) {
Function.prototype.bind = Function.prototype.bind || bind ;


require([
requirejs([
'jquery',
'contents',
'base/js/namespace',
Expand Down

0 comments on commit 4d258a8

Please sign in to comment.