feat(api): add Clipboard entry in webpack common (#127)

This commit is contained in:
Cynthia Foxwell 2022-10-21 16:18:32 -06:00 committed by GitHub
parent e2b622c76b
commit 6769de29cd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,7 +1,7 @@
import { User } from "discord-types/general"; import { User } from "discord-types/general";
import { lazyWebpack } from "../utils/misc"; import { lazyWebpack } from "../utils/misc";
import { _resolveReady, filters, waitFor } from "./webpack"; import { _resolveReady, filters, waitFor, mapMangledModuleLazy } from "./webpack";
import type Components from "discord-types/components"; import type Components from "discord-types/components";
import type Stores from "discord-types/stores"; import type Stores from "discord-types/stores";
@ -93,6 +93,11 @@ export const UserUtils = {
fetchUser: lazyWebpack(filters.byCode(".USER(", "getUser")) as (id: string) => Promise<User>, fetchUser: lazyWebpack(filters.byCode(".USER(", "getUser")) as (id: string) => Promise<User>,
}; };
export const Clipboard = mapMangledModuleLazy('document.queryCommandEnabled("copy")||document.queryCommandSupported("copy")', {
copy: filters.byCode(".default.copy("),
SUPPORTS_COPY: x => typeof x === "boolean",
});
waitFor("useState", m => React = m); waitFor("useState", m => React = m);
waitFor(["dispatch", "subscribe"], m => { waitFor(["dispatch", "subscribe"], m => {
FluxDispatcher = m; FluxDispatcher = m;