这是我最小的失败案例。
(ns hello
(:require-macros [devcards.core :as dc])
(:require [reagent.core :as r]
[devcards.core :as dc]
[gamma.api :as g]
[gamma.program :as p]
[goog.dom :as gdom]
[goog.webgl :as ggl]))
(defn main []
(let [canvas (.getElementById js/document "webgl")
gl (.getContext canvas "webgl")] ;; *** THIS LINE ***
(.clearColor gl 0.0 0.0 0.0 1.0)
(.clear gl gl.COLOR_BUFFER_BIT)))
(dc/defcard-rg canvas-example
[:div
[:canvas {:width 600
:height 600
:id "webgl"}]])
(main)下面是当我把它加载到小方格/devcard中时会发生的事情。
发布于 2016-10-28 00:41:17
好吧,我想出来了。
最简单的解决方案(即不涉及对devcard /试剂进行黑客攻击)是让单独的cljs/go线程每50 is检查一次,查看元素是否存在,如果存在,则执行该函数。
https://stackoverflow.com/questions/40294307
复制相似问题