commit | 975e55cbe4ac683c33d5256a91f4133fa97b4c34 | [log] [tgz] |
---|---|---|
author | Kevin Moore <kevmoo@users.noreply.github.com> | Thu Feb 15 13:03:57 2024 -0800 |
committer | GitHub <noreply@github.com> | Thu Feb 15 13:03:57 2024 -0800 |
tree | 1a40261e6f048b0aa18ca8200e25bf0ee51bcbd9 | |
parent | 044780752414a8e11981c29ab4193fdf23a44455 [diff] |
Add TrustedTypes (#173) Fixes https://github.com/dart-lang/web/issues/172
Lightweight browser API bindings built around JS static interop.
This package exposes browser APIs. It's generated from the Web IDL definitions and uses recent Dart language features for zero-overhead bindings.
This package is intended to replace dart:html
and similar Dart SDK libraries. It will support access to browser APIs from Dart code compiled to either JavaScript or WebAssembly.
import 'package:web/web.dart'; void main() { final div = document.querySelector('div')!; div.text = 'Text set at ${DateTime.now()}'; }
The generator scripts use a number of conventions to consistently handle Web IDL definitions:
JSObject
.implements
between extension types.JSArray
and JSPromise
.String
.JSFunction
.String
instead of JSString
.JSAny?
.JSObject
.Based on:
For instructions on re-generating the DOM bindings, see the generator docs.