diff options
-rw-r--r-- | src/cjr_print.sml | 10 | ||||
-rw-r--r-- | tests/appjs.ur | 5 |
2 files changed, 11 insertions, 4 deletions
diff --git a/src/cjr_print.sml b/src/cjr_print.sml index cfe8ee13..159948b3 100644 --- a/src/cjr_print.sml +++ b/src/cjr_print.sml @@ -2637,6 +2637,10 @@ fun p_file env (ds, ps) = newline] end + val timestamp = LargeInt.toString (Time.toMilliseconds (Time.now ())) + val app_js = OS.Path.joinDirFile {dir = Settings.getUrlPrefix (), + file = "app." ^ timestamp ^ ".js"} + fun p_page (ek, s, n, ts, ran, side, tellSig) = let val (ts, defInputs, inputsVar, fields) = @@ -2756,8 +2760,7 @@ fun p_file env (ds, ps) = let val scripts = "<script type=\\\"text/javascript\\\" src=\\\"" - ^ OS.Path.joinDirFile {dir = Settings.getUrlPrefix (), - file = "app.js"} + ^ app_js ^ "\\\"></script>\\n" in foldl (fn (x, scripts) => @@ -3117,8 +3120,7 @@ fun p_file env (ds, ps) = string "static void uw_handle(uw_context ctx, char *request) {", newline, string "if (!strcmp(request, \"", - string (OS.Path.joinDirFile {dir = Settings.getUrlPrefix (), - file = "app.js"}), + string app_js, string "\")) {", newline, box [string "uw_Basis_string ims = uw_Basis_requestHeader(ctx, \"If-modified-since\");", diff --git a/tests/appjs.ur b/tests/appjs.ur new file mode 100644 index 00000000..01e9f345 --- /dev/null +++ b/tests/appjs.ur @@ -0,0 +1,5 @@ +fun id n = if n = 0 then 0 else 1 + id (n - 1) + +fun main () : transaction page = return <xml><body> + <button onclick={alert (show (id 3))}/> +</body></xml> |