updated ui extensions api to allow top-level await calls
This commit is contained in:
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
- Silenced the superuser IPs confirmation if there is no change.
|
- Silenced the superuser IPs confirmation if there is no change.
|
||||||
|
|
||||||
|
- Updated UI extensions APIs to allow top-level `await` in the initialization script.
|
||||||
|
|
||||||
|
|
||||||
## v0.38.0
|
## v0.38.0
|
||||||
|
|
||||||
|
|||||||
+2
-1
@@ -81,7 +81,8 @@ func copyExtensionMainjs(buf *bytes.Buffer, ext core.UIExtension) error {
|
|||||||
defer f.Close()
|
defer f.Close()
|
||||||
|
|
||||||
// wrap in a self-executing function to avoid scope and concatenation issues
|
// wrap in a self-executing function to avoid scope and concatenation issues
|
||||||
_, _ = buf.WriteString("(function(){")
|
// (the await/async is for top-level await)
|
||||||
|
_, _ = buf.WriteString("await (async function(){")
|
||||||
|
|
||||||
_, err = io.Copy(buf, f)
|
_, err = io.Copy(buf, f)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -12,4 +12,4 @@ PB_DOCS_URL = "https://pocketbase.io/docs"
|
|||||||
PB_JS_SDK_URL = "https://github.com/pocketbase/js-sdk"
|
PB_JS_SDK_URL = "https://github.com/pocketbase/js-sdk"
|
||||||
PB_DART_SDK_URL = "https://github.com/pocketbase/dart-sdk"
|
PB_DART_SDK_URL = "https://github.com/pocketbase/dart-sdk"
|
||||||
PB_RELEASES = "https://github.com/pocketbase/pocketbase/releases"
|
PB_RELEASES = "https://github.com/pocketbase/pocketbase/releases"
|
||||||
PB_VERSION = "v0.38.0"
|
PB_VERSION = "v0.38.1-dev"
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
Vendored
+1
-1
@@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
<!-- prism -->
|
<!-- prism -->
|
||||||
<script src="./libs/prism/prism.js" data-manual></script>
|
<script src="./libs/prism/prism.js" data-manual></script>
|
||||||
<script type="module" crossorigin src="./assets/index-fOxZ9qpE.js"></script>
|
<script type="module" crossorigin src="./assets/index-C5XHp9-e.js"></script>
|
||||||
<link rel="modulepreload" crossorigin href="./assets/pocketbase.es-B_4DUNUU.js">
|
<link rel="modulepreload" crossorigin href="./assets/pocketbase.es-B_4DUNUU.js">
|
||||||
<link rel="stylesheet" crossorigin href="./assets/index-DR1PnFnr.css">
|
<link rel="stylesheet" crossorigin href="./assets/index-DR1PnFnr.css">
|
||||||
</head>
|
</head>
|
||||||
|
|||||||
+3
-4
@@ -134,8 +134,8 @@ watch(
|
|||||||
);
|
);
|
||||||
|
|
||||||
// load extensions
|
// load extensions
|
||||||
let extensionsScript = t.script({
|
document.body.appendChild(t.script({
|
||||||
type: "module",
|
type: "module", // allow top-level await
|
||||||
src: app.pb.buildURL("/_/extensions.js"),
|
src: app.pb.buildURL("/_/extensions.js"),
|
||||||
onload: () => {
|
onload: () => {
|
||||||
app.store._ready = true;
|
app.store._ready = true;
|
||||||
@@ -144,5 +144,4 @@ let extensionsScript = t.script({
|
|||||||
console.warn("Failed to load extensions:", err);
|
console.warn("Failed to load extensions:", err);
|
||||||
app.store._ready = true;
|
app.store._ready = true;
|
||||||
},
|
},
|
||||||
});
|
}));
|
||||||
document.body.appendChild(extensionsScript);
|
|
||||||
|
|||||||
Reference in New Issue
Block a user