Skip to content

Commit

Permalink
improve haptics in wasmJs demo app
Browse files Browse the repository at this point in the history
  • Loading branch information
Calvin-LL committed Feb 18, 2024
1 parent 6cef558 commit 13fdf16
Showing 1 changed file with 27 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package sh.calvin.reorderable.demo

import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import kotlinx.browser.window

@Composable
actual fun rememberReorderHapticFeedback(): ReorderHapticFeedback {
val reorderHapticFeedback = remember {
object : ReorderHapticFeedback() {
override fun performHapticFeedback(type: ReorderHapticFeedbackType) {
when (type) {
ReorderHapticFeedbackType.START ->
window.navigator.vibrate(5)

ReorderHapticFeedbackType.MOVE ->
window.navigator.vibrate(1)

ReorderHapticFeedbackType.END ->
window.navigator.vibrate(3)
}
}
}
}

return reorderHapticFeedback
}

0 comments on commit 13fdf16

Please sign in to comment.