本文整理匯總了TypeScript中@jupyterlab/observables.ObservableMap類的典型用法代碼示例。如果您正苦於以下問題:TypeScript ObservableMap類的具體用法?TypeScript ObservableMap怎麽用?TypeScript ObservableMap使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了ObservableMap類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: it
it('should return a list of the keys in the map', () => {
let value = new ObservableMap<number>();
value.set('one', 1);
value.set('two', 2);
value.set('three', 3);
let keys = value.keys();
expect(keys).to.eql(['one', 'two', 'three']);
});
示例2: it
it('should return a list of the values in the map', () => {
const value = new ObservableMap<number>();
value.set('one', 1);
value.set('two', 2);
value.set('three', 3);
const keys = value.values();
expect(keys).to.deep.equal([1, 2, 3]);
});
示例3: it
it('should be emitted when the map changes state', () => {
let called = false;
const value = new ObservableMap<number>();
value.changed.connect(() => {
called = true;
});
value.set('entry', 1);
expect(called).to.equal(true);
});