Skip to content

Commit

Permalink
Audio. Separate handle for AudioWorklet
Browse files Browse the repository at this point in the history
  • Loading branch information
turansky committed Nov 22, 2024
1 parent bef84ac commit 171a9ff
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Automatically generated - do not modify!

package web.worklets
package web.audio

import js.module.ModuleHandle

sealed external interface WorkletHandle :
sealed external interface AudioWorkletHandle :
ModuleHandle
3 changes: 1 addition & 2 deletions kotlin-browser/src/jsMain/kotlin/web/audio/audioWorklet.kt
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package web.audio

import web.worklets.WorkletHandle
import web.worklets.internal.createWorklet

fun audioWorklet(
block: (self: AudioWorkletGlobalScope) -> Unit,
): WorkletHandle =
): AudioWorkletHandle =
createWorklet("AudioWorkletGlobalScope", block)
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package web.worklets.internal

import js.module.ModuleHandle
import js.reflect.unsafeCast
import web.globals.internal.getGlobalScope
import web.worklets.WorkletGlobalScope
import web.worklets.WorkletHandle

internal fun <S : WorkletGlobalScope> createWorklet(
internal fun <S : WorkletGlobalScope, H : ModuleHandle> createWorklet(
scopeClassName: String,
block: (self: S) -> Unit,
): WorkletHandle {
): H {
val self: S = getGlobalScope(scopeClassName)
block(self)
return unsafeCast("Missed plugin integration! Worklet handle should be generated!")
Expand Down

0 comments on commit 171a9ff

Please sign in to comment.