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
import { nothing } from 'lit'; | |
import { AsyncDirective, directive, ElementPart, PartInfo, ElementPartInfo, PartType } from 'lit/async-directive.js'; | |
/** | |
* @emits accept - when the user accept the dialog | |
* @emits decline - when the user declines the dialog | |
*/ | |
class ConfirmDialogDirective extends AsyncDirective { | |
private element?: Element; | |
private config?: ConfirmDialogOptions; |
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
export async function getMagicNumber(file: File, signatureLength: number = 4) { | |
return file | |
.slice(0, signatureLength) | |
.arrayBuffer() | |
.then((buffer) => | |
Array.from(new Uint8Array(buffer)) | |
.map((byte) => byte.toString(16).padStart(2, '0')) | |
.join('') | |
.toUpperCase() | |
); |