"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.deleteGlobalRef = exports.setGlobalRef = exports.getGlobalRef = void 0;
const id_1 = require("./util/id");
function getGlobalRef(system, id) {
    const { global: { ref }, } = system;
    return ref[id] || null;
}
exports.getGlobalRef = getGlobalRef;
function setGlobalRef(system, unit) {
    const { global: { ref }, } = system;
    const id = (0, id_1.randomIdNotIn)(ref);
    ref[id] = unit;
    return id;
}
exports.setGlobalRef = setGlobalRef;
function deleteGlobalRef(system, id) {
    const { global: { ref }, } = system;
    delete ref[id];
}
exports.deleteGlobalRef = deleteGlobalRef;
//# sourceMappingURL=global.js.map