我想在JavaScript中創建對象並調用的方法。方法名稱已消失。我試圖無緣運用externs.js。出口DEFTYPE方法
(deftype ^:export SceneMain []
Object
(handleShow [_]
(display-categories)))
;; should be used in javascript as:
var s = new SceneMain();
s.handleShow();
;; Uncaught TypeError: Object [object Object] has no method 'handleShow'
;; Uncaught TypeError: Object #<dg> has no method 'handleShow'
這裏是我的externs.js
var SceneMain = {};
SceneMain.handleShow = function() {};
我想要得到閉包編譯器不會破壞handleShow函數名稱,這裏有一個javascript用法的例子。這似乎是一個已知的問題 - http://dev.clojure.org/jira/browse/CLJS-698 – edbond