• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

LouisBrunner / dnd-multi-backend / 7385497515

02 Jan 2024 12:00PM CUT coverage: 98.498%. Remained the same
7385497515

push

github

web-flow
chore(deps-dev): bump @typescript-eslint/parser from 6.16.0 to 6.17.0 (#252)

Bumps [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) from 6.16.0 to 6.17.0.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v6.17.0/packages/parser)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/parser"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

63 of 67 branches covered (0.0%)

Branch coverage included in aggregate %.

265 of 266 relevant lines covered (99.62%)

37.11 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

95.83
/packages/react-dnd-multi-backend/src/hooks/useMultiCommon.ts
1
import { useContext } from 'react'
57✔
2
import { DragDropManager, Backend } from 'dnd-core'
3
import { DndContext, DndContextType } from 'react-dnd'
9✔
4
import { MultiBackendSwitcher } from 'dnd-multi-backend'
5

6
type Fn<Spec, Res> = (spec: Spec) => Res
7

8
interface DragDropManagerImpl extends DragDropManager {
9
  receiveBackend(backend: Backend): void
10
}
11

12
const useForBackend = <Spec, Res>(spec: Spec, fn: Fn<Spec, Res>, manager: DragDropManagerImpl, backend: Backend): Res => {
9✔
13
  const previous = manager.getBackend()
12✔
14
  manager.receiveBackend(backend)
12✔
15
  const result = fn(spec)
12✔
16
  manager.receiveBackend(previous)
12✔
17
  return result
12✔
18
}
19

20
export const useMultiCommon = <Spec, Res>(spec: Spec, fn: Fn<Spec, Res>): [Res, Record<string, Res>] => {
9✔
21
  const dndContext = useContext<DndContextType>(DndContext)
30✔
22
  const dndBackend = dndContext?.dragDropManager?.getBackend()
30!
23
  if (dndBackend === undefined) {
30✔
24
    throw new Error('could not find backend, make sure you are using a <DndProvider />')
24✔
25
  }
26

27
  const result = fn(spec)
6✔
28
  const multiResult: Record<string, Res> = {}
6✔
29
  const backends = (dndBackend as MultiBackendSwitcher).backendsList()
6✔
30
  for (const backend of backends) {
6✔
31
    multiResult[backend.id] = useForBackend(spec, fn, dndContext.dragDropManager as DragDropManagerImpl, backend.instance)
12✔
32
  }
33

34
  return [result, multiResult]
6✔
35
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc