Upstream version 9.37.197.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / devtools / front_end / InspectorFrontendEventSink.js
1 /*
2  * Copyright 2014 The Chromium Authors. All rights reserved.
3  * Use of this source code is governed by a BSD-style license that can be
4  * found in the LICENSE file.
5  */
6
7
8 /**
9  * @constructor
10  * @extends {WebInspector.Object}
11  */
12 WebInspector.InspectorFrontendEventSink = function() {
13 }
14
15 WebInspector.InspectorFrontendEventSink.prototype = {
16     /**
17      * @param {string} eventType
18      * @param {function(!WebInspector.Event)} listener
19      * @param {!Object=} thisObject
20      */
21     addEventListener: function(eventType, listener, thisObject)
22     {
23         if (!this.hasEventListeners(eventType))
24             InspectorFrontendHost.subscribe(eventType);
25
26         WebInspector.Object.prototype.addEventListener.call(this, eventType, listener, thisObject);
27     },
28
29     /**
30      * @param {string} eventType
31      * @param {function(!WebInspector.Event)} listener
32      * @param {!Object=} thisObject
33      */
34     removeEventListener: function(eventType, listener, thisObject)
35     {
36         WebInspector.Object.prototype.removeEventListener.call(this, eventType, listener, thisObject);
37
38         if (!this.hasEventListeners(eventType))
39             InspectorFrontendHost.unsubscribe(eventType);
40     },
41
42     __proto__: WebInspector.Object.prototype
43 };