本文整理汇总了TypeScript中@nteract/actions.setLanguageInfo函数的典型用法代码示例。如果您正苦于以下问题:TypeScript setLanguageInfo函数的具体用法?TypeScript setLanguageInfo怎么用?TypeScript setLanguageInfo使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setLanguageInfo函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: mergeMap
mergeMap(msg => {
const c = msg.content;
const l = c.language_info;
const info: KernelInfo = {
protocolVersion: c.protocol_version,
implementation: c.implementation,
implementationVersion: c.implementation_version,
banner: c.banner,
helpLinks: c.help_links,
languageName: l.name,
languageVersion: l.version,
mimetype: l.mimetype,
fileExtension: l.file_extension,
pygmentsLexer: l.pygments_lexer,
codemirrorMode: l.codemirror_mode,
nbconvertExporter: l.nbconvert_exporter
};
return of(
// The original action we were using
actions.setLanguageInfo({
langInfo: msg.content.language_info,
kernelRef,
contentRef
}),
actions.setKernelInfo({
kernelRef,
info
})
);
})
示例2: test
test("sets the language object", () => {
const originalState = monocellDocument;
const action = actions.setLanguageInfo({ langInfo: "test" });
const state = reducers(originalState, action);
expect(state.getIn(["notebook", "metadata", "language_info"])).toBe("test");
});
示例3: mergeMap
mergeMap(msg => {
const c = msg.content;
const l = c.language_info;
const info: KernelInfo = {
protocolVersion: c.protocol_version,
implementation: c.implementation,
implementationVersion: c.implementation_version,
banner: c.banner,
helpLinks: c.help_links,
languageName: l.name,
languageVersion: l.version,
mimetype: l.mimetype,
fileExtension: l.file_extension,
pygmentsLexer: l.pygments_lexer,
codemirrorMode: l.codemirror_mode,
nbconvertExporter: l.nbconvert_exporter
};
let result;
if (!c.protocol_version.startsWith("5")) {
result = [
actions.launchKernelFailed({
kernelRef,
contentRef,
error: new Error(
"The kernel that you are attempting to launch does not support the latest version (v5) of the messaging protocol."
)
})
];
} else {
result = [
// The original action we were using
actions.setLanguageInfo({
langInfo: msg.content.language_info,
kernelRef,
contentRef
}),
actions.setKernelInfo({
kernelRef,
info
})
];
}
return of(...result);
})