πŸ“‹ Harmony Flow Patterns

Test cΓ‘c patterns để sync giα»―a multiple pages/tabs/iframes.

1️⃣ Popup Window Flow

Main page mở popup β†’ đợi popup hoΓ n thΓ nh β†’ continue flow.
page.expect_popup() + popup.wait_for_event('close')

2️⃣ LocalStorage Cross-Tab Sync

Tab 1 listen storage event β†’ Tab 2 set value β†’ Tab 1 auto update.
window.addEventListener('storage', ...)
Listener: Not Active
Current value: (none)

3️⃣ Polling Sync

Poll mα»™t endpoint để check status. Useful khi khΓ΄ng cΓ³ WebSocket.
setInterval + API check
Polling: Stopped Polls: 0

4️⃣ PostMessage (iframe ↔ parent)

Parent vΓ  iframe communicate qua postMessage. Cross-origin safe.
window.postMessage() + window.addEventListener('message')
[Parent] Ready to receive messages...

5️⃣ Promise-based Wait Flow

Đợi mα»™t Δ‘iều kiện xαΊ£y ra trΖ°α»›c khi continue. DΓΉng Promise + Event.
Step 1: Init
β†’
Step 2: Wait
β†’
Step 3: Continue
β†’
Step 4: Complete

6️⃣ Event-driven Chain Flow

Multiple steps, mα»—i step emit event cho step tiαΊΏp theo.
CustomEvent + addEventListener
1️⃣ Init
β†’
2️⃣ Validate
β†’
3️⃣ Process
β†’
4️⃣ Confirm
β†’
5️⃣ Complete

πŸ“‹ Harmony Flow Log

[Ready] Harmony Flow Test Page loaded!