()
| 206 | * open and close it. |
| 207 | */ |
| 208 | export const usePiPWindow = () => { |
| 209 | const context = createMemo(() => { |
| 210 | const ctx = useContext(PiPContext) |
| 211 | if (!ctx) { |
| 212 | throw new Error('usePiPWindow must be used within a PiPProvider') |
| 213 | } |
| 214 | return ctx() |
| 215 | }) |
| 216 | return context |
| 217 | } |