Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix loading label init #760

Merged
merged 2 commits into from
Aug 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
196 changes: 98 additions & 98 deletions docs/actions.html

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions docs/app-worker.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
const cacheName = "app-" + "99744976a78f1c0e6202f9856d65e47589cb83ca";
const cacheName = "app-" + "14a2a162a0ac80801aa21f83ff5b57d0a9226b3a";
const resourcesToCache = ["/","/app.css","/app.js","/manifest.webmanifest","/wasm_exec.js","/web/app.wasm","/web/css/docs.css","/web/css/prism.css","/web/documents/home-next.md","/web/documents/home.md","/web/documents/updates.md","/web/documents/what-is-go-app.md","/web/js/prism.js","https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500\u0026display=swap","https://storage.googleapis.com/murlok-github/icon-192.png","https://storage.googleapis.com/murlok-github/icon-512.png"];

self.addEventListener("install", (event) => {
console.log("installing app worker 99744976a78f1c0e6202f9856d65e47589cb83ca");
console.log("installing app worker 14a2a162a0ac80801aa21f83ff5b57d0a9226b3a");

event.waitUntil(
caches
Expand All @@ -28,7 +28,7 @@ self.addEventListener("activate", (event) => {
);
})
);
console.log("app worker 99744976a78f1c0e6202f9856d65e47589cb83ca is activated");
console.log("app worker 14a2a162a0ac80801aa21f83ff5b57d0a9226b3a is activated");
});

self.addEventListener("fetch", (event) => {
Expand Down
8 changes: 4 additions & 4 deletions docs/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ var goappNav = function () {};
var goappOnUpdate = function () {};
var goappOnAppInstallChange = function () {};

const goappEnv = {"GOAPP_INTERNAL_URLS":"null","GOAPP_ROOT_PREFIX":"","GOAPP_STATIC_RESOURCES_URL":"","GOAPP_VERSION":"99744976a78f1c0e6202f9856d65e47589cb83ca"};
const goappEnv = {"GOAPP_INTERNAL_URLS":"null","GOAPP_ROOT_PREFIX":"","GOAPP_STATIC_RESOURCES_URL":"","GOAPP_VERSION":"14a2a162a0ac80801aa21f83ff5b57d0a9226b3a"};
const goappLoadingLabel = "go-app documentation {progress}%";
const goappWasmContentLengthHeader = "";

let goappServiceWorkerRegistration;
Expand Down Expand Up @@ -207,9 +208,8 @@ async function goappInitWebAssembly() {
loaderIcon.className = "goapp-logo";

const loaderLabel = document.getElementById("app-wasm-loader-label");
const loadingLabel = loaderLabel.innerText;
const showProgress = (progress) => {
loaderLabel.innerText = loadingLabel.replace("{progress}", progress);
loaderLabel.innerText = goappLoadingLabel.replace("{progress}", progress);
};
showProgress(0);

Expand Down Expand Up @@ -247,7 +247,7 @@ async function fetchWithProgress(url, progess) {
if (!goappWasmContentLengthHeader || !contentLength) {
contentLength = response.headers.get("Content-Length");
}

const total = parseInt(contentLength, 10);
let loaded = 0;

Expand Down
192 changes: 96 additions & 96 deletions docs/architecture.html

Large diffs are not rendered by default.

200 changes: 100 additions & 100 deletions docs/components.html

Large diffs are not rendered by default.

224 changes: 112 additions & 112 deletions docs/concurrency.html

Large diffs are not rendered by default.

224 changes: 112 additions & 112 deletions docs/declarative-syntax.html

Large diffs are not rendered by default.

208 changes: 104 additions & 104 deletions docs/getting-started.html

Large diffs are not rendered by default.

218 changes: 109 additions & 109 deletions docs/github-deploy.html

Large diffs are not rendered by default.

242 changes: 121 additions & 121 deletions docs/index.html

Large diffs are not rendered by default.

212 changes: 106 additions & 106 deletions docs/install.html

Large diffs are not rendered by default.

184 changes: 92 additions & 92 deletions docs/js.html

Large diffs are not rendered by default.

188 changes: 94 additions & 94 deletions docs/lifecycle.html

Large diffs are not rendered by default.

216 changes: 108 additions & 108 deletions docs/migrate.html

Large diffs are not rendered by default.

208 changes: 104 additions & 104 deletions docs/notifications.html

Large diffs are not rendered by default.

176 changes: 88 additions & 88 deletions docs/privacy-policy.html

Large diffs are not rendered by default.

200 changes: 100 additions & 100 deletions docs/reference.html

Large diffs are not rendered by default.

196 changes: 98 additions & 98 deletions docs/routing.html

Large diffs are not rendered by default.

202 changes: 101 additions & 101 deletions docs/seo.html

Large diffs are not rendered by default.

244 changes: 122 additions & 122 deletions docs/states.html

Large diffs are not rendered by default.

196 changes: 98 additions & 98 deletions docs/static-resources.html

Large diffs are not rendered by default.

192 changes: 96 additions & 96 deletions docs/testing.html

Large diffs are not rendered by default.

Binary file modified docs/web/app.wasm
Binary file not shown.
6 changes: 3 additions & 3 deletions docs/web/documents/reference.html
Original file line number Diff line number Diff line change
Expand Up @@ -2913,7 +2913,7 @@ <h2 id="Dispatcher">type <a href="/src/github.com/maxence-charriere/go-app/v9/pk



<h2 id="Environment">type <a href="/src/github.com/maxence-charriere/go-app/v9/pkg/app/http.go?s=20315:20349#L830">Environment</a>
<h2 id="Environment">type <a href="/src/github.com/maxence-charriere/go-app/v9/pkg/app/http.go?s=20433:20467#L833">Environment</a>
<a class="permalink" href="#Environment">&#xb6;</a>


Expand Down Expand Up @@ -25123,7 +25123,7 @@ <h2 id="Handler">type <a href="/src/github.com/maxence-charriere/go-app/v9/pkg/a



<h3 id="Handler.ServeHTTP">func (*Handler) <a href="/src/github.com/maxence-charriere/go-app/v9/pkg/app/http.go?s=12755:12822#L511">ServeHTTP</a>
<h3 id="Handler.ServeHTTP">func (*Handler) <a href="/src/github.com/maxence-charriere/go-app/v9/pkg/app/http.go?s=12834:12901#L514">ServeHTTP</a>
<a class="permalink" href="#Handler.ServeHTTP">&#xb6;</a>


Expand All @@ -25137,7 +25137,7 @@ <h3 id="Handler.ServeHTTP">func (*Handler) <a href="/src/github.com/maxence-char



<h2 id="Icon">type <a href="/src/github.com/maxence-charriere/go-app/v9/pkg/app/http.go?s=19686:20223#L807">Icon</a>
<h2 id="Icon">type <a href="/src/github.com/maxence-charriere/go-app/v9/pkg/app/http.go?s=19804:20341#L810">Icon</a>
<a class="permalink" href="#Icon">&#xb6;</a>


Expand Down
6 changes: 3 additions & 3 deletions pkg/app/gen/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ var goappOnUpdate = function () {};
var goappOnAppInstallChange = function () {};

const goappEnv = {{.Env}};
const goappLoadingLabel = "{{.LoadingLabel}}";
const goappWasmContentLengthHeader = "{{.WasmContentLengthHeader}}";

let goappServiceWorkerRegistration;
Expand Down Expand Up @@ -207,9 +208,8 @@ async function goappInitWebAssembly() {
loaderIcon.className = "goapp-logo";

const loaderLabel = document.getElementById("app-wasm-loader-label");
const loadingLabel = loaderLabel.innerText;
const showProgress = (progress) => {
loaderLabel.innerText = loadingLabel.replace("{progress}", progress);
loaderLabel.innerText = goappLoadingLabel.replace("{progress}", progress);
};
showProgress(0);

Expand Down Expand Up @@ -247,7 +247,7 @@ async function fetchWithProgress(url, progess) {
if (!goappWasmContentLengthHeader || !contentLength) {
contentLength = response.headers.get("Content-Length");
}

const total = parseInt(contentLength, 10);
let loaded = 0;

Expand Down
5 changes: 4 additions & 1 deletion pkg/app/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ func (h *Handler) initPageContent() {
if h.Body == nil {
h.Body = Body
}

}

func (h *Handler) initPreRenderedResources() {
Expand Down Expand Up @@ -370,12 +371,14 @@ func (h *Handler) makeAppJS() []byte {
Must(template.New("app.js").Parse(appJS)).
Execute(&b, struct {
Env string
LoadingLabel string
Wasm string
WasmContentLengthHeader string
WorkerJS string
AutoUpdateInterval int64
}{
Env: jsonString(h.Env),
LoadingLabel: h.LoadingLabel,
Wasm: h.Resources.AppWASM(),
WasmContentLengthHeader: h.WasmContentLengthHeader,
WorkerJS: h.resolvePackagePath("/app-worker.js"),
Expand Down Expand Up @@ -652,7 +655,7 @@ func (h *Handler) servePage(w http.ResponseWriter, r *http.Request) {
page.SetDescription(h.Description)
page.SetAuthor(h.Author)
page.SetKeywords(h.Keywords...)
page.SetLoadingLabel(h.LoadingLabel)
page.SetLoadingLabel(strings.ReplaceAll(h.LoadingLabel, "{progress}", "0"))
page.SetImage(h.Image)
page.url = &url

Expand Down
2 changes: 1 addition & 1 deletion pkg/app/scripts.go

Large diffs are not rendered by default.