Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WebAPIs, as used in gnorium.com

Swift implementations of Web APIs for Swift WebAssembly environments, enabling JavaScript-like Web API usage in browser-based Swift applications.

Overview

WebAPIs provides Swift types and interfaces that mirror standard Web APIs, allowing you to write Swift code for WebAssembly with familiar Web platform conventions.

Built for Swift SDK for WebAssembly, enabling browser-based Swift applications with direct access to DOM, CSS, Storage, and other Web APIs.

Features

  • DOM-like APIs: Document manipulation interfaces
  • CSS APIs: CSSStyleDeclaration, color schemes, property setters
  • Console API: console.log() equivalents for WebAssembly debugging
  • Event APIs: CustomEvent and event handling
  • Dataset APIs: HTML5 dataset attribute handling

Installation

Swift Package Manager

Add WebAPIs to your Package.swift:

dependencies: [
    .package(url: "https://github.com/gnorium/web-apis", branch: "main")
]

Then add it to your target dependencies:

.target(
    name: "YourTarget",
    dependencies: [
        .product(name: "WebAPIs", package: "web-apis")
    ]
)

Usage

import WebAPIs

// Use Web APIs in Swift WebAssembly
let console = Console()
console.log("Hello from Swift WebAssembly!")

// Work with CSS properties
let style = CSSStyleDeclaration()
style.setProperty("color", value: "red")

Requirements

  • Swift 6.2+
  • Swift SDK for WebAssembly

License

Apache License 2.0 - See LICENSE for details

Contributing

Contributions welcome! Please open an issue or submit a pull request.

Related Packages

About

WebAPIs, as used in gnorium.com

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages