本文整理汇总了TypeScript中benchpress/common.provide函数的典型用法代码示例。如果您正苦于以下问题:TypeScript provide函数的具体用法?TypeScript provide怎么用?TypeScript provide使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了provide函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: createReporter
function createReporter({sampleId, descriptions, metrics, path}) {
var bindings = [
JsonFileReporter.BINDINGS,
provide(
SampleDescription, {useValue: new SampleDescription(sampleId, descriptions, metrics)}),
bind(JsonFileReporter.PATH).toValue(path),
bind(Options.NOW).toValue(() => DateWrapper.fromMillis(1234)),
bind(Options.WRITE_FILE).toValue((filename, content) => {
loggedFile = {'filename': filename, 'content': content};
return PromiseWrapper.resolve(null);
})
];
return Injector.resolveAndCreate(bindings).get(JsonFileReporter);
}
示例2: createExtension
function createExtension(perfRecords = null): WebDriverExtension {
if (isBlank(perfRecords)) {
perfRecords = [];
}
log = [];
extension =
Injector
.resolveAndCreate([
IOsDriverExtension.BINDINGS,
provide(WebDriverAdapter, {useValue: new MockDriverAdapter(log, perfRecords)})
])
.get(IOsDriverExtension);
return extension;
}
示例3: createReporter
function createReporter({columnWidth = null, sampleId = null, descriptions = null,
metrics = null}: {columnWidth?, sampleId?, descriptions?, metrics?}) {
log = [];
if (isBlank(descriptions)) {
descriptions = [];
}
if (isBlank(sampleId)) {
sampleId = 'null';
}
var bindings = [
ConsoleReporter.BINDINGS,
provide(SampleDescription,
{useValue: new SampleDescription(sampleId, descriptions, metrics)}),
bind(ConsoleReporter.PRINT).toValue((line) => log.push(line))
];
if (isPresent(columnWidth)) {
bindings.push(bind(ConsoleReporter.COLUMN_WIDTH).toValue(columnWidth));
}
reporter = ReflectiveInjector.resolveAndCreate(bindings).get(ConsoleReporter);
}
示例4: provide
ids.map(id => provide(id, {useValue: new MockExtension(id)})),
示例5: provide
ids.map(id => provide(id, {useValue: new MockMetric(id)})),
示例6: provide
ids.map(id => provide(id, {useValue: new MockReporter(id)})),