本文整理汇总了TypeScript中electron.remote.dialog.showSaveDialog方法的典型用法代码示例。如果您正苦于以下问题:TypeScript remote.dialog.showSaveDialog方法的具体用法?TypeScript remote.dialog.showSaveDialog怎么用?TypeScript remote.dialog.showSaveDialog使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类electron.remote.dialog
的用法示例。
在下文中一共展示了remote.dialog.showSaveDialog方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: sanitizeFilename
r.onloadend = () => {
const data = {
name: sanitizeFilename(self.visState.title.toLowerCase().replace(/\s/g, '-')),
image: r.result,
format: 'png'
};
remote.dialog.showSaveDialog(
remote.BrowserWindow.getAllWindows()[0],
{
title: 'Export to Image',
defaultPath: sanitizeFilename(data.name + '.' + data.format)
},
(name: string) => {
name && writeFileSync(name, arrayBufferToBuffer(data.image));
}
);
};
示例2:
buttonLabel: 'foo bar',
filters: [
{name: 'Images', extensions: ['jpg', 'png', 'gif']},
{name: 'Movies', extensions: ['mkv', 'avi', 'mp4']},
{name: 'Custom File Type', extensions: ['as']},
{name: 'All Files', extensions: ['*']}
],
properties: ['openFile', 'openDirectory', 'multiSelections', 'showHiddenFiles', 'createDirectory', 'promptToCreate', 'noResolveAliases'],
normalizeAccessKeys: true,
message: 'foo message',
});
// showSaveDialog
// https://electron.atom.io/docs/api/dialog/#dialogshowsavedialogbrowserwindow-options-callback
remote.dialog.showSaveDialog(win);
remote.dialog.showSaveDialog(win, {}, fileNames => fileNames);
remote.dialog.showSaveDialog(win, {
title: 'foo',
defaultPath: '/bar',
buttonLabel: 'foo bar',
filters: [
{name: 'Images', extensions: ['jpg', 'png', 'gif']},
{name: 'Movies', extensions: ['mkv', 'avi', 'mp4']},
{name: 'Custom File Type', extensions: ['as']},
{name: 'All Files', extensions: ['*']}
],
message: 'foo message',
nameFieldLabel: 'foo name',
showsTagField: true
});