我正在使用[cljsjs/localforage "1.2.10-0"]
当我这样做时:
(.setItem (.localforage js/window) "mynumber" (clj->js {:number (.-value number)}))
我在WebIDE控制台中收到此错误:
TypeError: *TypeError: window.localforage is not a function*
如果我在firefox浏览器中测试它,它会说同样的,如果我在控制台window.localforage.setItem()
中引入它,它可以工作:|
BONUS:每次我使用lein cljsbuild auto编译时都会得到这个:
*Upstream deps.cljs found on classpath. {:foreign-libs [{
:file "cljsjs/localforage/development/localforage.inc.js",
:provides ["cljsjs.localforage"],
:file-min "cljsjs/localforage/production/localforage.min.inc.js"
}],
:externs ["cljsjs/localForage/common/localforage.ext.js"]}
This is an EXPERIMENTAL FEATURE and is not guarenteed to remain
stable in future versions.*
答案 0 :(得分:1)
(.-localforage js/window)
[注意破折号]
(.setItem (.-localforage js/window) "mynumber" (clj->js {:number (.-value number)}))
到目前为止很好:D