Update JavascriptKit (#468)

* Bump JavaScriptKit dependency to 0.12.0.

* Update CHANGELOG.md for 0.9.1 release.

* Fix access to `hash` property

(now that JSObject conforms to Hashable it has a Swift hash property which overrides callAsFunction)

* Update CHANGELOG.md
This commit is contained in:
yonihemi 2022-02-16 18:41:05 +08:00 committed by GitHub
parent a9addc8cb1
commit 12606a809e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 17 additions and 10 deletions

View File

@ -1,3 +1,14 @@
# 0.9.1 (16 February 2022)
This release fixes an issue with `EnvironmentValues`, updates CI workflow for SwiftWasm 5.5, and bumps JavaScriptKit dependency to 0.12.0.
**Merged pull requests:**
- Fix typo ([#462](https://github.com/TokamakUI/Tokamak/pull/462)) via [@regexident](https://github.com/regexident)
- Fix `rootEnvironment` not merged with `.defaultEnvironment` ([#461](https://github.com/TokamakUI/Tokamak/pull/461)) via [@regexident](https://github.com/regexident)
- Build and test with SwiftWasm 5.5 on CI ([#460](https://github.com/TokamakUI/Tokamak/pull/460)) via [@MaxDesiatov](https://github.com/MaxDesiatov)
-
# 0.9.0 (26 November 2021)
This release adds support for SwiftWasm 5.5 and bumps the minimum required version to Swift 5.4.

View File

@ -6,8 +6,8 @@
"repositoryURL": "https://github.com/swiftwasm/JavaScriptKit.git",
"state": {
"branch": null,
"revision": "309e63c03d8116210ad0437f5d1f09a26d4de48b",
"version": "0.11.1"
"revision": "6c31bad4b1ef18385262f5154845648c8c95ae94",
"version": "0.12.0"
}
},
{

View File

@ -1,6 +1,4 @@
// swift-tools-version:5.4
// The swift-tools-version declares the minimum version of Swift required to
// build this package.
import PackageDescription
@ -72,11 +70,9 @@ let package = Package(
),
],
dependencies: [
// Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"),
.package(
url: "https://github.com/swiftwasm/JavaScriptKit.git",
.upToNextMinor(from: "0.11.1")
.upToNextMinor(from: "0.12.0")
),
.package(
url: "https://github.com/OpenCombine/OpenCombine.git",

View File

@ -22,11 +22,11 @@ private let window = JSObject.global.window.object!
private final class HashState: ObservableObject {
var onHashChange: JSClosure!
@Published var currentHash = location.hash.string!
@Published var currentHash = location["hash"].string!
init() {
let onHashChange = JSClosure { [weak self] _ in
self?.currentHash = location.hash.string!
self?.currentHash = location["hash"].string!
return .undefined
}
@ -48,7 +48,7 @@ struct URLHashDemo: View {
var body: some View {
VStack {
Button("Assign random location.hash") {
location.hash = .string("\(Int.random(in: 0...1000))")
location["hash"] = .string("\(Int.random(in: 0...1000))")
}
Text("Current location.hash is \(hashState.currentHash)")
}