# all files / ol/ disposable.js

100% Statements 9/9
100% Branches 2/2
100% Functions 2/2
100% Lines 9/9

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    331×

    1×

    1×

    1×

    1×
    711×
    710×
    710×

    1×
     goog.provide('ol.Disposable');

    goog.require('ol');

    /**
     * Objects that need to clean up after themselves.
     * @constructor
     */
    ol.Disposable = function() {};

    /**
     * The object has already been disposed.
     * @type {boolean}
     * @private
     */
    ol.Disposable.prototype.disposed_ = false;

    /**
     * Clean up.
     */
    ol.Disposable.prototype.dispose = function() {
      if (!this.disposed_) {
        this.disposed_ = true;
        this.disposeInternal();
      }
    };

    /**
     * Extension point for disposable objects.
     * @protected
     */
    ol.Disposable.prototype.disposeInternal = ol.nullFunction;