[英]Requiring multiple files for a worker in cljs
目前,我試圖用cljs庫仆人 。 我只能在這個摘錄中要求一個文件:
(def worker-script "/main.js") ;; This is whatever the name of the compiled javascript will be
我的main.js看起來像:
var CLOSURE_UNCOMPILED_DEFINES = null;
if(typeof goog == "undefined") document.write('<script src="js/main.out/goog/base.js"></script>');
document.write('<script src="js/main.out/cljs_deps.js"></script>');
document.write('<script>if (typeof goog != "undefined") { goog.require("boot.cljs.main8234"); } else { console.warn("ClojureScript could not load :main, did you forget to specify :asset-path?"); };</script>');
這會導致文檔未定義的錯誤,因為它是從一個我認為無權訪問html doc的worker調用的。 有什么方法可以解決這個問題嗎? 我曾想過制作一個單獨的worker.js
文件並填寫:
importScripts('main.out/goog/base.js', 'http://localhost:3000/js/main.out/goog/deps.js', 'main.out/cljs_deps.js');
if (typeof goog != "undefined") { goog.require("../boot.cljs.main8234"); } else { console.warn("ClojureScript could not load :main, did you forget to specify :asset-path?"); };
會工作,但我還沒有成功。 我按照maggimo使用boot來組織我的cljs 。 我的js文件存儲在js
目錄下。 如果我沒有提供任何必要的細節請說明,我會編輯。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.