@@ -434,6 +434,11 @@ public class FileSystemWritableFileStream: WritableStream {
434
434
}
435
435
}
436
436
437
+ public protocol NavigatorStorage : JSBridgedClass { }
438
+ public extension NavigatorStorage {
439
+ @inlinable var storage : StorageManager { jsObject [ Strings . storage] . fromJSValue ( ) ! }
440
+ }
441
+
437
442
public class OpenFilePickerOptions : BridgedDictionary {
438
443
public convenience init ( multiple: Bool ) {
439
444
let object = JSObject . global [ Strings . Object] . function!. new ( )
@@ -466,6 +471,85 @@ public class SaveFilePickerOptions: BridgedDictionary {
466
471
public var suggestedName : String ?
467
472
}
468
473
474
+ public class StorageEstimate : BridgedDictionary {
475
+ public convenience init ( usage: UInt64 , quota: UInt64 ) {
476
+ let object = JSObject . global [ Strings . Object] . function!. new ( )
477
+ object [ Strings . usage] = _toJSValue ( usage)
478
+ object [ Strings . quota] = _toJSValue ( quota)
479
+ self . init ( unsafelyWrapping: object)
480
+ }
481
+
482
+ public required init ( unsafelyWrapping object: JSObject ) {
483
+ _usage = ReadWriteAttribute ( jsObject: object, name: Strings . usage)
484
+ _quota = ReadWriteAttribute ( jsObject: object, name: Strings . quota)
485
+ super. init ( unsafelyWrapping: object)
486
+ }
487
+
488
+ @ReadWriteAttribute
489
+ public var usage : UInt64
490
+
491
+ @ReadWriteAttribute
492
+ public var quota : UInt64
493
+ }
494
+
495
+ public class StorageManager : JSBridgedClass {
496
+ @inlinable public class var constructor : JSFunction ? { JSObject . global [ Strings . StorageManager] . function }
497
+
498
+ public let jsObject : JSObject
499
+
500
+ public required init ( unsafelyWrapping jsObject: JSObject ) {
501
+ self . jsObject = jsObject
502
+ }
503
+
504
+ @inlinable public func getDirectory( ) -> JSPromise {
505
+ let this = jsObject
506
+ return this [ Strings . getDirectory] . function!( this: this, arguments: [ ] ) . fromJSValue ( ) !
507
+ }
508
+
509
+ @available ( macOS 10 . 15 , iOS 13 . 0 , watchOS 6 . 0 , tvOS 13 . 0 , * )
510
+ @inlinable public func getDirectory( ) async throws -> FileSystemDirectoryHandle {
511
+ let this = jsObject
512
+ let _promise : JSPromise = this [ Strings . getDirectory] . function!( this: this, arguments: [ ] ) . fromJSValue ( ) !
513
+ return try await _promise. value. fromJSValue ( ) !
514
+ }
515
+
516
+ @inlinable public func persisted( ) -> JSPromise {
517
+ let this = jsObject
518
+ return this [ Strings . persisted] . function!( this: this, arguments: [ ] ) . fromJSValue ( ) !
519
+ }
520
+
521
+ @available ( macOS 10 . 15 , iOS 13 . 0 , watchOS 6 . 0 , tvOS 13 . 0 , * )
522
+ @inlinable public func persisted( ) async throws -> Bool {
523
+ let this = jsObject
524
+ let _promise : JSPromise = this [ Strings . persisted] . function!( this: this, arguments: [ ] ) . fromJSValue ( ) !
525
+ return try await _promise. value. fromJSValue ( ) !
526
+ }
527
+
528
+ @inlinable public func persist( ) -> JSPromise {
529
+ let this = jsObject
530
+ return this [ Strings . persist] . function!( this: this, arguments: [ ] ) . fromJSValue ( ) !
531
+ }
532
+
533
+ @available ( macOS 10 . 15 , iOS 13 . 0 , watchOS 6 . 0 , tvOS 13 . 0 , * )
534
+ @inlinable public func persist( ) async throws -> Bool {
535
+ let this = jsObject
536
+ let _promise : JSPromise = this [ Strings . persist] . function!( this: this, arguments: [ ] ) . fromJSValue ( ) !
537
+ return try await _promise. value. fromJSValue ( ) !
538
+ }
539
+
540
+ @inlinable public func estimate( ) -> JSPromise {
541
+ let this = jsObject
542
+ return this [ Strings . estimate] . function!( this: this, arguments: [ ] ) . fromJSValue ( ) !
543
+ }
544
+
545
+ @available ( macOS 10 . 15 , iOS 13 . 0 , watchOS 6 . 0 , tvOS 13 . 0 , * )
546
+ @inlinable public func estimate( ) async throws -> StorageEstimate {
547
+ let this = jsObject
548
+ let _promise : JSPromise = this [ Strings . estimate] . function!( this: this, arguments: [ ] ) . fromJSValue ( ) !
549
+ return try await _promise. value. fromJSValue ( ) !
550
+ }
551
+ }
552
+
469
553
public enum WellKnownDirectory : JSString , JSValueCompatible {
470
554
case desktop = " desktop "
471
555
case documents = " documents "
@@ -545,13 +629,16 @@ public class WriteParams: BridgedDictionary {
545
629
@usableFromInline static let FileSystemHandle : JSString = " FileSystemHandle "
546
630
@usableFromInline static let FileSystemWritableFileStream : JSString = " FileSystemWritableFileStream "
547
631
@usableFromInline static let Object : JSString = " Object "
632
+ @usableFromInline static let StorageManager : JSString = " StorageManager "
548
633
@usableFromInline static let accept : JSString = " accept "
549
634
@usableFromInline static let at : JSString = " at "
550
635
@usableFromInline static let create : JSString = " create "
551
636
@usableFromInline static let createWritable : JSString = " createWritable "
552
637
@usableFromInline static let data : JSString = " data "
553
638
@usableFromInline static let description : JSString = " description "
639
+ @usableFromInline static let estimate : JSString = " estimate "
554
640
@usableFromInline static let excludeAcceptAllOption : JSString = " excludeAcceptAllOption "
641
+ @usableFromInline static let getDirectory : JSString = " getDirectory "
555
642
@usableFromInline static let getDirectoryHandle : JSString = " getDirectoryHandle "
556
643
@usableFromInline static let getFile : JSString = " getFile "
557
644
@usableFromInline static let getFileHandle : JSString = " getFileHandle "
@@ -563,20 +650,25 @@ public class WriteParams: BridgedDictionary {
563
650
@usableFromInline static let mode : JSString = " mode "
564
651
@usableFromInline static let multiple : JSString = " multiple "
565
652
@usableFromInline static let name : JSString = " name "
653
+ @usableFromInline static let persist : JSString = " persist "
654
+ @usableFromInline static let persisted : JSString = " persisted "
566
655
@usableFromInline static let position : JSString = " position "
567
656
@usableFromInline static let queryPermission : JSString = " queryPermission "
657
+ @usableFromInline static let quota : JSString = " quota "
568
658
@usableFromInline static let recursive : JSString = " recursive "
569
659
@usableFromInline static let removeEntry : JSString = " removeEntry "
570
660
@usableFromInline static let requestPermission : JSString = " requestPermission "
571
661
@usableFromInline static let resolve : JSString = " resolve "
572
662
@usableFromInline static let seek : JSString = " seek "
573
663
@usableFromInline static let size : JSString = " size "
574
664
@usableFromInline static let startIn : JSString = " startIn "
665
+ @usableFromInline static let storage : JSString = " storage "
575
666
@usableFromInline static let suggestedName : JSString = " suggestedName "
576
667
@usableFromInline static let toString : JSString = " toString "
577
668
@usableFromInline static let truncate : JSString = " truncate "
578
669
@usableFromInline static let type : JSString = " type "
579
670
@usableFromInline static let types : JSString = " types "
671
+ @usableFromInline static let usage : JSString = " usage "
580
672
@usableFromInline static let write : JSString = " write "
581
673
}
582
674
0 commit comments