Path: blob/trunk/third_party/closure/goog/disposable/disposeall.js
4176 views
/**1* @license2* Copyright The Closure Library Authors.3* SPDX-License-Identifier: Apache-2.04*/56/**7* @fileoverview The disposeAll method is used to clean up references and8* resources.9*/1011goog.module('goog.disposeAll');12goog.module.declareLegacyNamespace();1314const dispose = goog.require('goog.dispose');15const utils = goog.require('goog.utils');1617/**18* Calls `dispose` on each member of the list that supports it. (If the19* member is an ArrayLike, then `goog.disposeAll()` will be called20* recursively on each of its members.) If the member is not an object with a21* `dispose()` method, then it is ignored.22* @param {...*} var_args The list.23*/24function disposeAll(var_args) {25for (let i = 0, len = arguments.length; i < len; ++i) {26const disposable = arguments[i];27if (utils.isArrayLike(disposable)) {28disposeAll.apply(null, disposable);29} else {30dispose(disposable);31}32}33}34exports = disposeAll;353637