24 lines
612 B
JavaScript
24 lines
612 B
JavaScript
|
"use strict";
|
||
|
|
||
|
Object.defineProperty(exports, "__esModule", {
|
||
|
value: true
|
||
|
});
|
||
|
exports.default = Disposable;
|
||
|
/** @license MIT License (c) copyright 2010-2016 original author or authors */
|
||
|
/** @author Brian Cavalier */
|
||
|
/** @author John Hann */
|
||
|
|
||
|
/**
|
||
|
* Create a new Disposable which will dispose its underlying resource.
|
||
|
* @param {function} dispose function
|
||
|
* @param {*?} data any data to be passed to disposer function
|
||
|
* @constructor
|
||
|
*/
|
||
|
function Disposable(dispose, data) {
|
||
|
this._dispose = dispose;
|
||
|
this._data = data;
|
||
|
}
|
||
|
|
||
|
Disposable.prototype.dispose = function () {
|
||
|
return this._dispose(this._data);
|
||
|
};
|