@ -18,6 +18,16 @@
define ( function ( require ) {
"use strict" ;
var warn _bad _name = function ( name ) {
if ( name !== "" && ! name . match ( /:/ ) ) {
console . warn ( 'You are trying to use an action/command name, where the separator between prefix and name is not `:`\n' +
'"' + name + '"\n' +
'You are likely to not use the API in a correct way. Typically use the following:\n' +
'`var key = actions.register(<object>, "<name>", "<prefix>");` and reuse the `key` variable' +
'instead of re-generating the key yourself.'
) ;
}
} ;
var ActionHandler = function ( env ) {
this . env = env || { } ;
@ -620,9 +630,9 @@ define(function(require){
for ( k in custom _ignore ) {
// Js closure are function level not block level need to wrap in a IIFE
// same as above, but decide for themselves w ether or not they intercept events.
// same as above, but decide for themselves w h ether or not they intercept events.
if ( custom _ignore . hasOwnProperty ( k ) ) {
var handler = _prepare _handler ( final _actions , k , custom _ignore ) ;
handler = _prepare _handler ( final _actions , k , custom _ignore ) ;
( function ( key , handler ) {
final _actions [ 'jupyter-notebook:' + key ] . handler = function ( env , event ) {
return handler ( env , event ) ;
@ -693,6 +703,7 @@ define(function(require){
* * /
if ( typeof ( name _or _data ) === 'string' ) {
warn _bad _name ( name ) ;
if ( this . exists ( name _or _data ) ) {
return name _or _data ;
} else {
@ -704,6 +715,7 @@ define(function(require){
} ;
ActionHandler . prototype . get = function ( name ) {
warn _bad _name ( name ) ;
return this . _actions [ name ] ;
} ;