Skip to content

[BridgeJS] Uncaught TypeError: import object field '<project>' is not an Object #672

@Amzd

Description

@Amzd

When using ElementaryUI and BridgeJS combined compilation succeeds but runtime crashes on start with:

Uncaught TypeError: import object field '<project>' is not an Object
@View
struct Counter {
    @State var count = 0

    var body: some View {
        div {
            p { "Count: \(count)" }
            button { "Increment" }
                .onClick { count += 1 }
        }.onAppear {
            try? console().log("Hello from Swift!")
        }
    }
}

import JavaScriptKit

@JSFunction func console() throws(JSException) -> Console

@JSClass struct Console {
    @JSFunction func log(_ message: String) throws(JSException) -> Void
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions