Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(25)

Side by Side Diff: chrome/browser/resources/bookmark_manager/js/cr/event.js

Issue 1141007: Bookmark manager js lib: Some cleanup of the event class docs.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/resources/bookmark_manager/js/cr/eventtarget.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @fileoverview This is a simple pure JS event class that can be used with 6 * @fileoverview This provides a nicer way to create events than what DOM
7 * {@code cr.ui.EventTarget}. It should not be used with DOM EventTargets. 7 * provides. These events can be used with DOM EventTarget interfaces as well
8 * as with {@code cr.EventTarget}.
8 */ 9 */
9 10
10 cr.define('cr', function() { 11 cr.define('cr', function() {
11 12
12 // cr.Event is called CustomEvent in here to prevent naming conflicts. We 13 // cr.Event is called CrEvent in here to prevent naming conflicts. We also
13 // alse store the original Event in case someone does a global alias of 14 // store the original Event in case someone does a global alias of cr.Event.
14 // cr.Event.
15 15
16 const DomEvent = Event; 16 const DomEvent = Event;
17 17
18 /** 18 /**
19 * Creates a new event to be used with cr.EventTarget or DOM EventTarget 19 * Creates a new event to be used with cr.EventTarget or DOM EventTarget
20 * objects. 20 * objects.
21 * @param {string} type The name of the event. 21 * @param {string} type The name of the event.
22 * @param {boolean=} 22 * @param {boolean=} opt_bubbles Whether the event bubbles. Default is false.
23 * @param {boolean=} opt_preventable Whether the default action of the event
24 * can be prevented.
23 * @constructor 25 * @constructor
26 * @extends {DomEvent}
24 */ 27 */
25 function CustomEvent(type, opt_bubbles, opt_capture) { 28 function CrEvent(type, opt_bubbles, opt_preventable) {
26 var e = cr.doc.createEvent('Event'); 29 var e = cr.doc.createEvent('Event');
27 e.initEvent(type, !!opt_bubbles, !!opt_capture); 30 e.initEvent(type, !!opt_bubbles, !!opt_preventable);
28 e.__proto__ = CustomEvent.prototype; 31 e.__proto__ = CrEvent.prototype;
29 return e; 32 return e;
30 } 33 }
31 34
32 CustomEvent.prototype = { 35 CrEvent.prototype = {
33 __proto__: DomEvent.prototype 36 __proto__: DomEvent.prototype
34 }; 37 };
35 38
36 // Export 39 // Export
37 return { 40 return {
38 Event: CustomEvent 41 Event: CrEvent
39 }; 42 };
40 }); 43 });
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/bookmark_manager/js/cr/eventtarget.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698