@reset-framework/sdk 1.1.0 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/client.js +29 -4
package/package.json
CHANGED
package/src/client.js
CHANGED
|
@@ -717,13 +717,35 @@ function createNetApi(transport) {
|
|
|
717
717
|
})
|
|
718
718
|
}
|
|
719
719
|
|
|
720
|
+
function scheduleFrontendReadySignal(transport) {
|
|
721
|
+
const target = typeof globalThis === "object" ? globalThis.window : undefined
|
|
722
|
+
|
|
723
|
+
if (typeof target === "undefined") {
|
|
724
|
+
return
|
|
725
|
+
}
|
|
726
|
+
|
|
727
|
+
if (target.__resetFrontendReadySignalScheduled) {
|
|
728
|
+
return
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
target.__resetFrontendReadySignalScheduled = true
|
|
732
|
+
|
|
733
|
+
queueMicrotask(() => {
|
|
734
|
+
if (!transport.isAvailable()) {
|
|
735
|
+
return
|
|
736
|
+
}
|
|
737
|
+
|
|
738
|
+
transport.invokeRaw("runtime.signalFrontendReady", {}).catch(() => {})
|
|
739
|
+
})
|
|
740
|
+
}
|
|
741
|
+
|
|
720
742
|
export function createResetClient(source) {
|
|
721
743
|
const transport = createResetTransport(source)
|
|
722
744
|
const commands = createCommandApi(transport)
|
|
723
745
|
const app = createAppApi(transport)
|
|
724
746
|
const runtime = createRuntimeApi(transport)
|
|
725
747
|
const events = createEventApi(transport)
|
|
726
|
-
const
|
|
748
|
+
const windowApi = createWindowApi(transport)
|
|
727
749
|
const dialog = createDialogApi(transport)
|
|
728
750
|
const fs = createFsApi(transport)
|
|
729
751
|
const path = createPathApi(transport)
|
|
@@ -742,8 +764,7 @@ export function createResetClient(source) {
|
|
|
742
764
|
const protocol = createProtocolApi(transport, events)
|
|
743
765
|
const updater = createUpdaterApi(transport)
|
|
744
766
|
const net = createNetApi(transport)
|
|
745
|
-
|
|
746
|
-
return Object.freeze({
|
|
767
|
+
const client = Object.freeze({
|
|
747
768
|
isAvailable() {
|
|
748
769
|
return transport.isAvailable()
|
|
749
770
|
},
|
|
@@ -754,7 +775,7 @@ export function createResetClient(source) {
|
|
|
754
775
|
app,
|
|
755
776
|
runtime,
|
|
756
777
|
events,
|
|
757
|
-
window,
|
|
778
|
+
window: windowApi,
|
|
758
779
|
dialog,
|
|
759
780
|
fs,
|
|
760
781
|
path,
|
|
@@ -774,6 +795,10 @@ export function createResetClient(source) {
|
|
|
774
795
|
updater,
|
|
775
796
|
net
|
|
776
797
|
})
|
|
798
|
+
|
|
799
|
+
scheduleFrontendReadySignal(transport)
|
|
800
|
+
|
|
801
|
+
return client
|
|
777
802
|
}
|
|
778
803
|
|
|
779
804
|
export {
|