Add library events (#2448)

This commit is contained in:
Lipis 2020-12-04 19:18:20 +02:00 committed by GitHub
parent a2132c9bb7
commit e392bebc40
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 35 additions and 4 deletions

View file

@ -7,6 +7,7 @@ import { loadFromBlob } from "./blob";
import { Library } from "./library";
import { MIME_TYPES } from "../constants";
import { clearElementsForExport } from "../element";
import { EVENT_LIBRARY, trackEvent } from "../analytics";
export const serializeAsJSON = (
elements: readonly ExcalidrawElement[],
@ -83,6 +84,7 @@ export const saveLibraryAsJSON = async () => {
description: "Excalidraw library file",
extensions: [".excalidrawlib"],
});
trackEvent(EVENT_LIBRARY, "save");
};
export const importLibraryFromJSON = async () => {
@ -91,5 +93,6 @@ export const importLibraryFromJSON = async () => {
extensions: [".json", ".excalidrawlib"],
mimeTypes: ["application/json"],
});
trackEvent(EVENT_LIBRARY, "load");
Library.importLibrary(blob);
};