本文整理汇总了TypeScript中@jupyterlab/coreutils.URLExt.encodeParts方法的典型用法代码示例。如果您正苦于以下问题:TypeScript URLExt.encodeParts方法的具体用法?TypeScript URLExt.encodeParts怎么用?TypeScript URLExt.encodeParts使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@jupyterlab/coreutils.URLExt
的用法示例。
在下文中一共展示了URLExt.encodeParts方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: getCurrent
execute: args => {
let current = getCurrent(args);
if (!current) {
return;
}
let notebookPath = URLExt.encodeParts(current.context.path);
let url = URLExt.join(
services.serverSettings.baseUrl,
'nbconvert',
(args['format']) as string,
notebookPath
) + '?download=true';
let w = window.open('', '_blank');
if (current.context.model.dirty && !current.context.model.readOnly) {
return current.context.save().then(() => {
w.location.assign(url);
});
} else {
return new Promise((resolve, reject) => {
w.location.assign(url);
});
}
},
示例2: getCurrent
execute: args => {
const current = getCurrent(args);
if (!current) {
return;
}
const notebookPath = URLExt.encodeParts(current.context.path);
const url = URLExt.join(
services.serverSettings.baseUrl,
'nbconvert',
(args['format']) as string,
notebookPath
) + '?download=true';
const child = window.open('', '_blank');
const { context } = current;
if (context.model.dirty && !context.model.readOnly) {
return context.save().then(() => { child.location.assign(url); });
}
return new Promise<void>((resolve) => {
child.location.assign(url);
resolve(undefined);
});
},
示例3: it
it('should encode and join a sequence of url components', () => {
expect(URLExt.encodeParts('>/>')).to.equal('%3E/%3E');
});