本文整理汇总了TypeScript中@jupyterlab/observables.ObservableString类的典型用法代码示例。如果您正苦于以下问题:TypeScript ObservableString类的具体用法?TypeScript ObservableString怎么用?TypeScript ObservableString使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ObservableString类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
it('should trigger a changed signal', () => {
let called = false;
const value = new ObservableString('full');
value.changed.connect((sender, args) => {
expect(sender).to.equal(value);
expect(args.type).to.equal('set');
expect(args.start).to.equal(0);
expect(args.end).to.equal(0);
expect(args.value).to.equal('');
called = true;
});
value.clear();
expect(called).to.equal(true);
});
示例2: it
it('should trigger a changed signal', () => {
let called = false;
let value = new ObservableString('one two two three');
value.changed.connect((sender, args) => {
expect(sender).to.be(value);
expect(args.type).to.be('remove');
expect(args.start).to.be(4);
expect(args.end).to.be(8);
expect(args.value).to.be('two ');
called = true;
});
value.remove(4, 8);
expect(called).to.be(true);
});