mirror of
https://github.com/RoboSats/robosats.git
synced 2025-09-13 00:56:22 +00:00

* Add SVG icons for map pins * Add federation basis and new coordinator form (#793) * Add new coordinator entry issue form * Add Federation basis * Fix eslint errors from F2F and fix languages * Redo eslint @typescript-eslint/strict-boolean-expressions * Robot Page working * Contexts Working * Garage Working * CurrentOrder working * Federation model working --------- Co-authored-by: Reckless_Satoshi <reckless.satoshi@protonmail.com> Co-authored-by: Reckless_Satoshi <90936742+Reckless-Satoshi@users.noreply.github.com>
25 lines
687 B
TypeScript
25 lines
687 B
TypeScript
/* function to save DATA as text from browser
|
|
* @param {String} file -- file name to save to
|
|
* @param {filename} data -- object to save
|
|
*/
|
|
|
|
const saveAsJson = (filename: string, dataObjToWrite: any): void => {
|
|
const blob = new Blob([JSON.stringify(dataObjToWrite, null, 2)], { type: 'text/json' });
|
|
const link = document.createElement('a');
|
|
|
|
link.download = filename;
|
|
link.href = window.URL.createObjectURL(blob);
|
|
link.dataset.downloadurl = ['text/json', link.download, link.href].join(':');
|
|
|
|
const evt = new MouseEvent('click', {
|
|
view: window,
|
|
bubbles: true,
|
|
cancelable: true,
|
|
});
|
|
|
|
link.dispatchEvent(evt);
|
|
link.remove();
|
|
};
|
|
|
|
export default saveAsJson;
|