Show More
@@ -1,23 +1,24 | |||||
1 | // Copyright (c) IPython Development Team. |
|
1 | // Copyright (c) IPython Development Team. | |
2 | // Distributed under the terms of the Modified BSD License. |
|
2 | // Distributed under the terms of the Modified BSD License. | |
3 |
|
3 | |||
4 | // Give us an object to bind all events to. This object should be created |
|
4 | // Give us an object to bind all events to. This object should be created | |
5 | // before all other objects so it exists when others register event handlers. |
|
5 | // before all other objects so it exists when others register event handlers. | |
6 |
// To |
|
6 | // To register an event handler: | |
|
7 | // | |||
7 | // require(['base/js/events'], function (events) { |
|
8 | // require(['base/js/events'], function (events) { | |
8 | // events.on("event.Namespace", function () {do_stuff(); }); |
|
9 | // events.on("event.Namespace", function () { do_stuff(); }); | |
9 | // }) |
|
10 | // }); | |
10 |
|
11 | |||
11 | define(['base/js/namespace', 'jquery'], function(IPython, $) { |
|
12 | define(['base/js/namespace', 'jquery'], function(IPython, $) { | |
12 | "use strict"; |
|
13 | "use strict"; | |
13 |
|
14 | |||
14 | var Events = function () {}; |
|
15 | var Events = function () {}; | |
15 |
|
16 | |||
16 | var events = new Events(); |
|
17 | var events = new Events(); | |
17 |
|
18 | |||
18 | // Backwards compatability. |
|
19 | // Backwards compatability. | |
19 | IPython.Events = Events; |
|
20 | IPython.Events = Events; | |
20 | IPython.events = events; |
|
21 | IPython.events = events; | |
21 |
|
22 | |||
22 | return $([events]); |
|
23 | return $([events]); | |
23 | }); |
|
24 | }); |
General Comments 0
You need to be logged in to leave comments.
Login now