How to use the @jupyterlab/observables/src.ModelDB 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 yuvipanda / simplest-notebook / tests / test-observables / src / modeldb.spec.ts View on Github external
it('should accept a baseDB', () => {
        const base = new ModelDB();
        const db = new ModelDB({ baseDB: base });
        expect(db instanceof ModelDB).to.equal(true);
      });
    });
github yuvipanda / simplest-notebook / tests / test-observables / src / modeldb.spec.ts View on Github external
it('should dispose of the resources used by the model', () => {
        const db = new ModelDB();
        const str = db.createString('str');
        const view = db.view('base');
        const str2 = view.createString('str');
        expect(db.isDisposed).to.equal(false);
        expect(str.isDisposed).to.equal(false);
        expect(view.isDisposed).to.equal(false);
        expect(str2.isDisposed).to.equal(false);
        db.dispose();
        expect(db.isDisposed).to.equal(true);
        expect(str.isDisposed).to.equal(true);
        expect(view.isDisposed).to.equal(true);
        expect(str2.isDisposed).to.equal(true);
      });
github yuvipanda / simplest-notebook / tests / test-observables / src / modeldb.spec.ts View on Github external
it('should create an ObservableValue`', () => {
        const db = new ModelDB();
        const value = db.createValue('value');
        expect(value instanceof ObservableValue).to.equal(true);
      });
github yuvipanda / simplest-notebook / tests / test-observables / src / modeldb.spec.ts View on Github external
it('should be able to retrieve that value using `get`', () => {
        const db = new ModelDB();
        const value = db.createString('value');
        expect(db.get('value')).to.equal(value);
      });
    });
github yuvipanda / simplest-notebook / tests / test-observables / src / modeldb.spec.ts View on Github external
it('should be safe to call more than once', () => {
        const db = new ModelDB();
        expect(db.isDisposed).to.equal(false);
        db.dispose();
        expect(db.isDisposed).to.equal(true);
      });
    });
github yuvipanda / simplest-notebook / tests / test-observables / src / modeldb.spec.ts View on Github external
it('should get a value that exists at a path', () => {
        const db = new ModelDB();
        const value = db.createValue('value');
        const value2 = db.get('value');
        expect(value2).to.equal(value);
      });
github yuvipanda / simplest-notebook / tests / test-observables / src / modeldb.spec.ts View on Github external
it('should return false for a value that does not exist', () => {
        const db = new ModelDB();
        expect(db.has('value')).to.equal(false);
      });
    });
github yuvipanda / simplest-notebook / tests / test-observables / src / modeldb.spec.ts View on Github external
it('should return a view onto the base ModelDB', () => {
        const db = new ModelDB();
        const view = db.view('base');

        db.createString('base.str1');
        expect(db.get('base.str1')).to.equal(view.get('str1'));

        view.createString('str2');
        expect(db.get('base.str2')).to.equal(view.get('str2'));
      });
github yuvipanda / simplest-notebook / tests / test-observables / src / modeldb.spec.ts View on Github external
it('should return true if a value exists at a path', () => {
        const db = new ModelDB();
        db.createValue('value');
        expect(db.has('value')).to.equal(true);
      });
github yuvipanda / simplest-notebook / tests / test-observables / src / modeldb.spec.ts View on Github external
it('should create an ObservableUndoableList`', () => {
        const db = new ModelDB();
        const str = db.createList('vec');
        expect(str instanceof ObservableUndoableList).to.equal(true);
      });