本文整理汇总了TypeScript中core/util/templating.replace_placeholders函数的典型用法代码示例。如果您正苦于以下问题:TypeScript replace_placeholders函数的具体用法?TypeScript replace_placeholders怎么用?TypeScript replace_placeholders使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了replace_placeholders函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
it("should ignore extra/unused formatters", () => {
const s1 = tmpl.replace_placeholders("stuff @foo{(0.000 %)}", source, 0, {"quux": "numeral"})
expect(s1).to.be.equal("stuff 1000.000 %")
const s2 = tmpl.replace_placeholders("stuff @foo{(0.000 %)}", source, 1, {"quux": "numeral"})
expect(s2).to.be.equal("stuff 100.200 %")
})
示例2: execute
execute(_cb_obj, cb_data) {
for (const i of get_indices(cb_data.source)) {
const url = replace_placeholders(this.url, cb_data.source, i);
window.open(url);
}
return null;
}
示例3: replace_placeholders
const open_url = (i: number) => {
const url = replace_placeholders(this.url, source, i)
if (this.same_tab)
window.location.href = url
else
window.open(url)
}
示例4: execute
execute(_cb_obj: any, cb_data: {[key: string]: any}): any {
for (const i of get_indices(cb_data.source)) {
const url = replace_placeholders(this.url, cb_data.source, i)
window.open(url)
}
return null
}