@teradataprebuilt/fastcall-linux-node-v59
Version:
fastcall - Very fast, asynchronous, dyncall based foreign function interface library for Node.js
67 lines (52 loc) • 2.18 kB
JavaScript
/*
Copyright 2016 Gábor Mező (gabor.mezo@outlook.com)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
;
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var _ = require('lodash');
var scope = require('./scope');
var Scoped = function () {
function Scoped() {
_classCallCheck(this, Scoped);
scope._add(this);
}
_createClass(Scoped, [{
key: '_dispose',
value: function _dispose() {
dispose(this);
}
}]);
return Scoped;
}();
Scoped.Legacy = function () {
scope._add(this);
};
Scoped.Legacy.prototype._dispose = function () {
dispose(this);
};
function dispose(obj) {
if (_.isFunction(obj.free)) {
return obj.free();
}
if (_.isFunction(obj.release)) {
return obj.release();
}
if (_.isFunction(obj.close)) {
return obj.close();
}
if (_.isFunction(obj.dispose)) {
return obj.dispose();
}
}
module.exports = scope.Scoped = Scoped;
//# sourceMappingURL=Scoped.js.map