本文整理匯總了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');
});