Skip to content

Commit

Permalink
chore: update logic
Browse files Browse the repository at this point in the history
  • Loading branch information
zouhang committed Apr 10, 2024
1 parent bb16905 commit a6615e6
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions entrypoints/injected/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,16 @@ import App from './App.tsx'
// import '@unocss/reset/tailwind.css'
import 'uno.css'

const sleep = (ms: number) => new Promise<true>((resolve) => setTimeout(() => resolve(true), ms))

export default defineUnlistedScript(() => {
window.onload = async function () {
const figmaReady = !!(window as any).figma && getCanvas() != null && getObjectsPanel() != null
const tempadReady = document.querySelector('tempad') != null
await waitFor(() => figmaReady || tempadReady)
await waitFor(
() =>
(!!(window as any).figma && getCanvas() != null && getObjectsPanel() != null) ||
document.querySelector('tempad')?.querySelector('header') != null,
)
await waitFor(() => sleep(1000))

window.fubukicss_figma = (window as any).figma || (mockFigma as any)

Expand Down

0 comments on commit a6615e6

Please sign in to comment.