fqtree
Version:
a flexible quadtree for JavaScript/TypeScript
46 lines • 1.41 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.get_qt_cache = exports.get_data_cache = exports.DataCache = void 0;
var onsreo_1 = require("onsreo");
var DataCache = /** @class */ (function () {
function DataCache() {
this.cache = new Map();
}
DataCache.prototype.destroy = function () {
this.cache.clear();
};
DataCache.prototype.add = function (data, id) {
this.cache.set(id, data);
};
DataCache.prototype.all = function () {
return this.cache.values();
};
DataCache.prototype.get = function (id) {
return id ? this.cache.get(id) : undefined;
};
DataCache.prototype.has = function (id) {
return id ? this.cache.has(id) : false;
};
DataCache.prototype.remove = function (id) {
id && this.cache.delete(id);
};
return DataCache;
}());
exports.DataCache = DataCache;
var __qt_data_cache = null;
function get_data_cache() {
if ((0, onsreo_1.is_none)(__qt_data_cache)) {
__qt_data_cache = new DataCache();
}
return __qt_data_cache;
}
exports.get_data_cache = get_data_cache;
var __qt_quadrant_cache = null;
function get_qt_cache() {
if ((0, onsreo_1.is_none)(__qt_quadrant_cache)) {
__qt_quadrant_cache = new DataCache();
}
return __qt_quadrant_cache;
}
exports.get_qt_cache = get_qt_cache;
//# sourceMappingURL=caches.js.map