Skip to content

Instantly share code, notes, and snippets.

@fogus
Created September 30, 2011 19:12
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fogus/1254701 to your computer and use it in GitHub Desktop.
Save fogus/1254701 to your computer and use it in GitHub Desktop.
How to access this in ClojureScript (subject to change)
;;;;;; GLOBAL THIS
(defn f []
(this-as self
(println self))
[self])
(f)
;; #<Object Global>
;;=> [#<undefined>]
;;;;;; METHOD THIS
(def o (array))
(extend-object! o {:foo f})
(. o (foo))
;; #<Array []>
;;=> [#<undefined>]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment