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