forked from vuejs/devtools
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(client): support export & import settings JSON
- Loading branch information
1 parent
27fd74a
commit c8ca41f
Showing
4 changed files
with
81 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
export function readFileAsText(file: Blob) { | ||
return new Promise((resolve, reject) => { | ||
const reader = new FileReader() | ||
reader.onload = () => resolve(reader.result) | ||
reader.onerror = () => reject(new Error('Failed to read file')) | ||
reader.readAsText(file) | ||
}) | ||
} | ||
|
||
export function downloadFile(content: Blob, filename: string) { | ||
const url = URL.createObjectURL(content) | ||
const a = document.createElement('a') | ||
a.href = url | ||
a.download = filename | ||
a.click() | ||
URL.revokeObjectURL(url) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export * from './color' | ||
export * from './time' | ||
export * from './file' |