How to use the @jupyterlab/observables.ObservableValue function in @jupyterlab/observables

To help you get started, we’ve selected a few @jupyterlab/observables examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jupyterlab / jupyterlab-data-explorer / tests / test-observables / src / modeldb.spec.ts View on Github external
it('should accept no arguments', () => {
        const value = new ObservableValue();
        expect(value instanceof ObservableValue).to.equal(true);
        expect(value.get()).to.be.null;
      });
github jupyterlab / jupyterlab-data-explorer / tests / test-observables / src / modeldb.spec.ts View on Github external
it('should accept an initial JSON value', () => {
        const value = new ObservableValue('value');
        expect(value instanceof ObservableValue).to.equal(true);
        const value2 = new ObservableValue({ one: 'one', two: 2 });
        expect(value2 instanceof ObservableValue).to.equal(true);
      });
    });
github jupyterlab / jupyterlab-data-explorer / tests / test-observables / src / modeldb.spec.ts View on Github external
it('should return `Value`', () => {
        const value = new ObservableValue();
        expect(value.type).to.equal('Value');
      });
    });
github jupyterlab / jupyterlab-data-explorer / tests / test-observables / src / modeldb.spec.ts View on Github external
it('should get the value of the object', () => {
        const value = new ObservableValue('value');
        expect(value.get()).to.equal('value');
        const value2 = new ObservableValue({ one: 'one', two: 2 });
        expect(
          JSONExt.deepEqual(value2.get(), { one: 'one', two: 2 })
        ).to.equal(true);
      });
    });
github jupyterlab / jupyterlab-data-explorer / tests / test-observables / src / modeldb.spec.ts View on Github external
it('should test whether the value is disposed', () => {
        const value = new ObservableValue();
        expect(value.isDisposed).to.equal(false);
        value.dispose();
        expect(value.isDisposed).to.equal(true);
      });
    });
github jupyterlab / jupyterlab-data-explorer / tests / test-observables / src / modeldb.spec.ts View on Github external
it('should get the value of the object', () => {
        const value = new ObservableValue('value');
        expect(value.get()).to.equal('value');
        const value2 = new ObservableValue({ one: 'one', two: 2 });
        expect(
          JSONExt.deepEqual(value2.get(), { one: 'one', two: 2 })
        ).to.equal(true);
      });
    });
github jupyterlab / jupyterlab-data-explorer / tests / test-observables / src / modeldb.spec.ts View on Github external
it('should accept an initial JSON value', () => {
        const value = new ObservableValue('value');
        expect(value instanceof ObservableValue).to.equal(true);
        const value2 = new ObservableValue({ one: 'one', two: 2 });
        expect(value2 instanceof ObservableValue).to.equal(true);
      });
    });
github jupyterlab / jupyterlab-data-explorer / tests / test-observables / src / modeldb.spec.ts View on Github external
it('should have value changed args', () => {
        let called = false;
        const value = new ObservableValue();
        value.changed.connect((sender, args) => {
          expect(sender).to.equal(value);
          expect(args.newValue).to.equal('set');
          expect(args.oldValue).to.be.null;
          called = true;
        });
        value.set('set');
        expect(called).to.equal(true);
      });
    });
github jupyterlab / jupyterlab-data-explorer / tests / test-observables / src / modeldb.spec.ts View on Github external
it('should be emitted when the map changes state', () => {
        let called = false;
        const value = new ObservableValue();
        value.changed.connect(() => {
          called = true;
        });
        value.set('set');
        expect(called).to.equal(true);
      });
github eWaterCycle / jupyterlab_thredds / src / browser.ts View on Github external
constructor(initialName: string = '', placeholder?: string) {
        super();
        this._nameNode = document.createElement('div');
        this._editNode = document.createElement('input');

        this._placeholder = placeholder || '';

        this.node.appendChild(this._nameNode);
        this.name = new ObservableValue(initialName);
        this._nameNode.textContent = initialName || this._placeholder;

        this.node.onclick = () => {
            if (this._pending) {
                return;
            }
            this._pending = true;
            Private.changeField(this._nameNode, this._editNode).then(value => {
                this._pending = false;
                if (this.name.get() !== value) {
                    this.name.set(value);
                }
            });
        };

        this.name.changed.connect((s, args) => {