UNPKG

@intuitionrobotics/thunderstorm

Version:
28 lines 1.04 kB
import {} from "../../shared/consts.js"; import { BadImplementationException, ImplementationMissingException } from "@intuitionrobotics/ts-common"; import * as React from "react"; export function browserType() { if (navigator?.vendor.includes("Google")) { return 'chrome'; } throw new BadImplementationException("No matching browser detected"); } export function convertBase64ToFile(fileName, base64, _mimeType) { const arr = base64.split(','); const match = arr[0].match(/:(.*?);/); const mimeType = (match && match[1]) || (_mimeType && _mimeType); if (!mimeType) throw new ImplementationMissingException("Could not extract mime type from data..."); const bstr = atob(arr[1]); let n = bstr.length; const u8arr = new Uint8Array(n); while (n--) { u8arr[n] = bstr.charCodeAt(n); } return new File([u8arr], fileName, { type: mimeType }); } export const stopPropagation = (e) => { e.preventDefault(); e.stopPropagation(); }; //# sourceMappingURL=tools.js.map