import JavaScriptKit

// This function is automatically generated by the @JS plugin
// It demonstrates how to use TypeScript functions and types imported from bridge-js.d.ts
@JS public func run() throws(JSException) {
    // Call the imported consoleLog function defined in bridge-js.d.ts
    try consoleLog("Hello, World!")

    // Get the document object - this comes from the imported getDocument() function
    let document = try getDocument()

    // Access and modify properties - the title property is read/write
    try document.setTitle("Hello, World!")

    // Access read-only properties - body is defined as readonly in TypeScript
    let body = try document.body

    // Create a new element using the document.createElement method
    let h1 = try document.createElement("h1")

    // Set properties on the created element
    try h1.setInnerText("Hello, World!")

    // Call methods on objects - appendChild is defined in the HTMLElement interface
    try body.appendChild(h1)
}
