(target: DragTarget, stringFormatter: LocalizedStringFormatter)
| 80 | } |
| 81 | |
| 82 | export function beginDragging(target: DragTarget, stringFormatter: LocalizedStringFormatter): void { |
| 83 | if (dragSession) { |
| 84 | throw new Error('Cannot begin dragging while already dragging'); |
| 85 | } |
| 86 | |
| 87 | dragSession = new DragSession(target, stringFormatter); |
| 88 | requestAnimationFrame(() => { |
| 89 | if (dragSession) { |
| 90 | dragSession.setup(); |
| 91 | if (getDragModality() === 'keyboard') { |
| 92 | dragSession.next(); |
| 93 | } |
| 94 | } |
| 95 | }); |
| 96 | |
| 97 | for (let cb of subscriptions) { |
| 98 | cb(); |
| 99 | } |
| 100 | } |
| 101 | |
| 102 | export function useDragSession(): DragSession | null { |
| 103 | let [session, setSession] = useState(dragSession); |
nothing calls this directly
no test coverage detected