Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
SeleniumHQ
GitHub Repository: SeleniumHQ/Selenium
Path: blob/trunk/third_party/closure/goog/disposable/idisposable.js
4167 views
1
/**
2
* @license
3
* Copyright The Closure Library Authors.
4
* SPDX-License-Identifier: Apache-2.0
5
*/
6
7
/**
8
* @fileoverview Definition of the disposable interface. A disposable object
9
* has a dispose method to to clean up references and resources.
10
*/
11
12
13
goog.provide('goog.disposable.IDisposable');
14
15
goog.require('goog.utils');
16
17
18
19
/**
20
* Interface for a disposable object. If a instance requires cleanup, it should
21
* implement this interface (it may subclass goog.Disposable).
22
*
23
* Examples of cleanup that can be done in `dispose` method:
24
* 1. Remove event listeners.
25
* 2. Cancel timers (setTimeout, setInterval, goog.Timer).
26
* 3. Call `dispose` on other disposable objects hold by current object.
27
* 4. Close connections (e.g. WebSockets).
28
*
29
* Note that it's not required to delete properties (e.g. DOM nodes) or set them
30
* to null as garbage collector will collect them assuming that references to
31
* current object will be lost after it is disposed.
32
*
33
* See also http://go/mdn/JavaScript/Memory_Management.
34
*
35
* @record
36
*/
37
goog.disposable.IDisposable = function() {};
38
39
40
/**
41
* Disposes of the object and its resources.
42
* @return {void} Nothing.
43
*/
44
goog.disposable.IDisposable.prototype.dispose = goog.utils.abstractMethod;
45
46
47
/**
48
* @return {boolean} Whether the object has been disposed of.
49
*/
50
goog.disposable.IDisposable.prototype.isDisposed = goog.utils.abstractMethod;
51
52