UNPKG

jupyterlab-emrys

Version:

A computational environment for Jupyter. Powered by Emrys

65 lines (64 loc) 1.66 kB
// Copyright (c) Jupyter Development Team. // Distributed under the terms of the Modified BSD License. "use strict"; /** * An implementation of a metadata cursor. */ var MetadataCursor = (function () { /** * Construct a new metadata cursor. * * @param name - The metadata namespace key. * * @param read - The read callback. * * @param write - The write callback. */ function MetadataCursor(name, read, write) { this._name = ''; this._read = null; this._write = null; this._name = name; this._read = read; this._write = write; } Object.defineProperty(MetadataCursor.prototype, "name", { /** * Get the namespace key of the metadata. * * #### Notes * This is a read-only property. */ get: function () { return this._name; }, enumerable: true, configurable: true }); /** * Dispose of the resources used by the cursor. * * #### Notes * This is not meant to be called by user code. */ MetadataCursor.prototype.dispose = function () { this._read = null; this._write = null; }; /** * Get the value of the namespace data. */ MetadataCursor.prototype.getValue = function () { var read = this._read; return read(); }; /** * Set the value of the namespace data. */ MetadataCursor.prototype.setValue = function (value) { var write = this._write; write(value); }; return MetadataCursor; }()); exports.MetadataCursor = MetadataCursor;