本文整理汇总了TypeScript中base.Models类的典型用法代码示例。如果您正苦于以下问题:TypeScript Models类的具体用法?TypeScript Models怎么用?TypeScript Models使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Models类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: expect
it.skip("have all non-Widget view models from Python in the Models object", () => {
const missing = []
for (const name of core_defaults.all_view_model_names()) {
if (!(name in Models.registered_names())) {
missing.push(name)
}
}
for (const m of missing) {
console.log(`'Models.${m}' not found but there's a Python model '${m}'`)
}
expect(missing.length).to.equal(0)
})
开发者ID:FourtekIT-incubator,项目名称:bokeh,代码行数:12,代码来源:defaults.ts
示例2: it
it("have all view models from Python in registered locations", () => {
const registered: {[key: string]: boolean} = {}
for (const name of Models.registered_names()) {
registered[name] = true
}
const missing = []
const all_view_model_names = concat([core_defaults.all_view_model_names(), widget_defaults.all_view_model_names()])
for (const name of all_view_model_names) {
if (!(name in registered)) {
missing.push(name)
}
}
for (const m of missing) {
console.log(`'base.locations["${m}"]' not found but there's a Python model '${m}'`)
}
expect(missing.length).to.equal(0)
})
开发者ID:FourtekIT-incubator,项目名称:bokeh,代码行数:17,代码来源:defaults.ts
示例3: constructor
constructor(attrs?: Partial<AnotherModel.Attrs>) {
super(attrs)
}
static initClass(): void {
this.prototype.type = 'AnotherModel'
this.define<AnotherModel.Props>({
bar: [ p.Number, 1 ],
})
}
}
AnotherModel.initClass()
Models.register('AnotherModel', AnotherModel)
namespace SomeModel {
export type Attrs = p.AttrsOf<Props>
export type Props = Model.Props & {
foo: p.Property<number>
child: p.Property<Model | null>
}
}
interface SomeModel extends SomeModel.Attrs {}
class SomeModel extends Model {
properties: SomeModel.Props
constructor(attrs?: Partial<SomeModel.Attrs>) {
开发者ID:jsignell,项目名称:bokeh,代码行数:30,代码来源:document.ts
注:本文中的base.Models类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论