()
| 179 | * open and close it. |
| 180 | */ |
| 181 | export const usePiPWindow = () => { |
| 182 | const context = createMemo(() => { |
| 183 | const ctx = useContext(PiPContext) |
| 184 | if (!ctx) { |
| 185 | throw new Error('usePiPWindow must be used within a PiPProvider') |
| 186 | } |
| 187 | return ctx() |
| 188 | }) |
| 189 | return context |
| 190 | } |