Source: ARCore/session.js

/**
 * Simple, non-persistant key-value store. Session is reactive, so it can
 * be used in conjunction with {@link Lens.Deps}, particularly
 * `Lens.Deps.autorun`.
 *
 * @namespace
 * @name Lens.Session
 */
define(["common/util/dep_map", "common/util/check"], function(DepMap, check) {
    "use strict";

    var map = {};
    var deps = DepMap();

    var Session = /** @lends Lens.Session */ {
        /**
         * Sets key to value.
         * @param {String} key
         * @param {Object} value
         */
        set: function(key, value) {
            check(key, String);

            if(map[key] === value) {
                return;
            }

            map[key] = value;
            deps.changed(key);
        },

        /**
         * Gets the value of key.
         * @param {String} key
         */
        get: function(key) {
            check(key, String);

            deps.depend(key);
            return map[key];
        }
    };

    Lens._addMember(Session, "Session");
    return Session;
});