events.js
24 lines
| 696 B
| application/javascript
|
JavascriptLexer
Jonathan Frederic
|
r17189 | // Copyright (c) IPython Development Team. | ||
// Distributed under the terms of the Modified BSD License. | ||||
Brian Granger
|
r6047 | |||
// Give us an object to bind all events to. This object should be created | ||||
// before all other objects so it exists when others register event handlers. | ||||
MinRK
|
r17322 | // To register an event handler: | ||
// | ||||
MinRK
|
r17317 | // require(['base/js/events'], function (events) { | ||
MinRK
|
r17322 | // events.on("event.Namespace", function () { do_stuff(); }); | ||
// }); | ||||
MinRK
|
r17317 | |||
define(['base/js/namespace', 'jquery'], function(IPython, $) { | ||||
Matthias BUSSONNIER
|
r12103 | "use strict"; | ||
Brian Granger
|
r6047 | |||
var Events = function () {}; | ||||
Jonathan Frederic
|
r17193 | |||
MinRK
|
r17320 | var events = new Events(); | ||
MinRK
|
r17317 | |||
Jonathan Frederic
|
r17189 | // Backwards compatability. | ||
Brian Granger
|
r6047 | IPython.Events = Events; | ||
MinRK
|
r17317 | IPython.events = events; | ||
Jonathan Frederic
|
r17195 | |||
MinRK
|
r17317 | return $([events]); | ||
Jonathan Frederic
|
r17189 | }); | ||