1/** 2 * @license 3 * Copyright The Closure Library Authors. 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7/** 8 * @fileoverview The dispose method is used to clean up references and 9 * resources. 10 */ 11 12goog.module('goog.dispose'); 13goog.module.declareLegacyNamespace(); 14 15/** 16 * Calls `dispose` on the argument if it supports it. If obj is not an 17 * object with a dispose() method, this is a no-op. 18 * @param {*} obj The object to dispose of. 19 */ 20function dispose(obj) { 21 if (obj && typeof obj.dispose == 'function') { 22 obj.dispose(); 23 } 24} 25exports = dispose; 26 27