Re: [ClojureScript] typeahead works with :compile :simple, not :compile :advanced

2015-05-13 Thread Jamie Orchard-Hays
Thanks, David. That could be the problem. When using :compile :simple, are 
externs ignored?

Cheers,

Jamie

On May 13, 2015, at 12:27 PM, David Nolen dnolen.li...@gmail.com wrote:

 There is no guarantee that using the library itself as the extern will work. 
 In fact you should be surprised if it works unless the library follow strict 
 conventions.
 
 David
 
 On Wed, May 13, 2015 at 12:23 PM, Jamie Orchard-Hays jamie...@gmail.com 
 wrote:
 Hoping someone might have some insight that can help with this.
 
 I'm using Twitters Typehead (0.9.3, before its big rework) in a 
 re-frame/reagent app.
 
 Below is a snippet that works fine when :compile :simple is used, but fails 
 when :compile :advanced is used. I'm using the typeahead.js and hogan.js as 
 externs. It seems to me that :advanced must be stripping something out the is 
 needed, but no clue how to determine what it is and more importantly what to 
 do about it. When (js/alert...) is called, the value is undefined under 
 :advanced, though the proper object is there, just without values for .-casrn 
 or .-common_name.
 
 (reagent/create-class
  {:component-did-mount
   (let [params {:name casrns
 :valueKey casrn
 :remote
 {:url 
 /raw_materials/casrn_cn_auto_complete.json?casrn=%QUERY,
  :cache true}
 :limit 20
 :template div style='width:300px'{{casrn}}: 
 {{common_name}}/div
 :engine js/Hogan}]
 (fn [self]
   (js/$
(fn  [] (.typeahead (js/$ #casrn) (clj-js params))
  (.on (js/$ #casrn)
   typeahead:selected
   (fn  [o, datum]
 (let [casrn (.-casrn datum)
   common_name (.-common_name datum)]
   (js/alert (.-casrn datum))
   (update :casrn casrn)
   (update :common_name common_name)
   (.val (js/$ #common_name) common_name
 
 --
 Note that posts from new members are moderated - please be patient with your 
 first post.
 ---
 You received this message because you are subscribed to the Google Groups 
 ClojureScript group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to clojurescript+unsubscr...@googlegroups.com.
 To post to this group, send email to clojurescript@googlegroups.com.
 Visit this group at http://groups.google.com/group/clojurescript.
 
 
 -- 
 Note that posts from new members are moderated - please be patient with your 
 first post.
 --- 
 You received this message because you are subscribed to the Google Groups 
 ClojureScript group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to clojurescript+unsubscr...@googlegroups.com.
 To post to this group, send email to clojurescript@googlegroups.com.
 Visit this group at http://groups.google.com/group/clojurescript.

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
ClojureScript group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojurescript+unsubscr...@googlegroups.com.
To post to this group, send email to clojurescript@googlegroups.com.
Visit this group at http://groups.google.com/group/clojurescript.


Re: [ClojureScript] typeahead works with :compile :simple, not :compile :advanced

2015-05-13 Thread David Nolen
There is no guarantee that using the library itself as the extern will
work. In fact you should be surprised if it works unless the library follow
strict conventions.

David

On Wed, May 13, 2015 at 12:23 PM, Jamie Orchard-Hays jamie...@gmail.com
wrote:

 Hoping someone might have some insight that can help with this.

 I'm using Twitters Typehead (0.9.3, before its big rework) in a
 re-frame/reagent app.

 Below is a snippet that works fine when :compile :simple is used, but
 fails when :compile :advanced is used. I'm using the typeahead.js and
 hogan.js as externs. It seems to me that :advanced must be stripping
 something out the is needed, but no clue how to determine what it is and
 more importantly what to do about it. When (js/alert...) is called, the
 value is undefined under :advanced, though the proper object is there, just
 without values for .-casrn or .-common_name.

 (reagent/create-class
  {:component-did-mount
   (let [params {:name casrns
 :valueKey casrn
 :remote
 {:url
 /raw_materials/casrn_cn_auto_complete.json?casrn=%QUERY,
  :cache true}
 :limit 20
 :template div style='width:300px'{{casrn}}:
 {{common_name}}/div
 :engine js/Hogan}]
 (fn [self]
   (js/$
(fn  [] (.typeahead (js/$ #casrn) (clj-js params))
  (.on (js/$ #casrn)
   typeahead:selected
   (fn  [o, datum]
 (let [casrn (.-casrn datum)
   common_name (.-common_name datum)]
   (js/alert (.-casrn datum))
   (update :casrn casrn)
   (update :common_name common_name)
   (.val (js/$ #common_name) common_name

 --
 Note that posts from new members are moderated - please be patient with
 your first post.
 ---
 You received this message because you are subscribed to the Google Groups
 ClojureScript group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to clojurescript+unsubscr...@googlegroups.com.
 To post to this group, send email to clojurescript@googlegroups.com.
 Visit this group at http://groups.google.com/group/clojurescript.


-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
ClojureScript group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojurescript+unsubscr...@googlegroups.com.
To post to this group, send email to clojurescript@googlegroups.com.
Visit this group at http://groups.google.com/group/clojurescript.


Re: [ClojureScript] typeahead works with :compile :simple, not :compile :advanced

2015-05-13 Thread Daniel Kersten
As far as I know, in compile simple identifiers are not renamed, so externs
are not needed.

On Wed, 13 May 2015 17:28 Jamie Orchard-Hays jamie...@gmail.com wrote:

 Thanks, David. That could be the problem. When using :compile :simple, are
 externs ignored?

 Cheers,

 Jamie

 On May 13, 2015, at 12:27 PM, David Nolen dnolen.li...@gmail.com wrote:

 There is no guarantee that using the library itself as the extern will
 work. In fact you should be surprised if it works unless the library follow
 strict conventions.

 David

 On Wed, May 13, 2015 at 12:23 PM, Jamie Orchard-Hays jamie...@gmail.com
 wrote:

 Hoping someone might have some insight that can help with this.

 I'm using Twitters Typehead (0.9.3, before its big rework) in a
 re-frame/reagent app.

 Below is a snippet that works fine when :compile :simple is used, but
 fails when :compile :advanced is used. I'm using the typeahead.js and
 hogan.js as externs. It seems to me that :advanced must be stripping
 something out the is needed, but no clue how to determine what it is and
 more importantly what to do about it. When (js/alert...) is called, the
 value is undefined under :advanced, though the proper object is there, just
 without values for .-casrn or .-common_name.

 (reagent/create-class
  {:component-did-mount
   (let [params {:name casrns
 :valueKey casrn
 :remote
 {:url
 /raw_materials/casrn_cn_auto_complete.json?casrn=%QUERY,
  :cache true}
 :limit 20
 :template div style='width:300px'{{casrn}}:
 {{common_name}}/div
 :engine js/Hogan}]
 (fn [self]
   (js/$
(fn  [] (.typeahead (js/$ #casrn) (clj-js params))
  (.on (js/$ #casrn)
   typeahead:selected
   (fn  [o, datum]
 (let [casrn (.-casrn datum)
   common_name (.-common_name datum)]
   (js/alert (.-casrn datum))
   (update :casrn casrn)
   (update :common_name common_name)
   (.val (js/$ #common_name) common_name

 --
 Note that posts from new members are moderated - please be patient with
 your first post.
 ---
 You received this message because you are subscribed to the Google Groups
 ClojureScript group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to clojurescript+unsubscr...@googlegroups.com.
 To post to this group, send email to clojurescript@googlegroups.com.
 Visit this group at http://groups.google.com/group/clojurescript.



 --
 Note that posts from new members are moderated - please be patient with
 your first post.
 ---
 You received this message because you are subscribed to the Google Groups
 ClojureScript group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to clojurescript+unsubscr...@googlegroups.com.
 To post to this group, send email to clojurescript@googlegroups.com.
 Visit this group at http://groups.google.com/group/clojurescript.


  --
 Note that posts from new members are moderated - please be patient with
 your first post.
 ---
 You received this message because you are subscribed to the Google Groups
 ClojureScript group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to clojurescript+unsubscr...@googlegroups.com.
 To post to this group, send email to clojurescript@googlegroups.com.
 Visit this group at http://groups.google.com/group/clojurescript.


-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
ClojureScript group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojurescript+unsubscr...@googlegroups.com.
To post to this group, send email to clojurescript@googlegroups.com.
Visit this group at http://groups.google.com/group/clojurescript.


Re: [ClojureScript] typeahead works with :compile :simple, not :compile :advanced

2015-05-13 Thread Jamie Orchard-Hays
Yup. I realized right after I sent the email that only :advanced needs externs.


On May 13, 2015, at 12:33 PM, Daniel Kersten dkers...@gmail.com wrote:

 As far as I know, in compile simple identifiers are not renamed, so externs 
 are not needed.
 
 
 On Wed, 13 May 2015 17:28 Jamie Orchard-Hays jamie...@gmail.com wrote:
 Thanks, David. That could be the problem. When using :compile :simple, are 
 externs ignored?
 
 Cheers,
 
 Jamie
 
 On May 13, 2015, at 12:27 PM, David Nolen dnolen.li...@gmail.com wrote:
 
 There is no guarantee that using the library itself as the extern will work. 
 In fact you should be surprised if it works unless the library follow strict 
 conventions.
 
 David
 
 On Wed, May 13, 2015 at 12:23 PM, Jamie Orchard-Hays jamie...@gmail.com 
 wrote:
 Hoping someone might have some insight that can help with this.
 
 I'm using Twitters Typehead (0.9.3, before its big rework) in a 
 re-frame/reagent app.
 
 Below is a snippet that works fine when :compile :simple is used, but fails 
 when :compile :advanced is used. I'm using the typeahead.js and hogan.js as 
 externs. It seems to me that :advanced must be stripping something out the 
 is needed, but no clue how to determine what it is and more importantly what 
 to do about it. When (js/alert...) is called, the value is undefined under 
 :advanced, though the proper object is there, just without values for 
 .-casrn or .-common_name.
 
 (reagent/create-class
  {:component-did-mount
   (let [params {:name casrns
 :valueKey casrn
 :remote
 {:url 
 /raw_materials/casrn_cn_auto_complete.json?casrn=%QUERY,
  :cache true}
 :limit 20
 :template div style='width:300px'{{casrn}}: 
 {{common_name}}/div
 :engine js/Hogan}]
 (fn [self]
   (js/$
(fn  [] (.typeahead (js/$ #casrn) (clj-js params))
  (.on (js/$ #casrn)
   typeahead:selected
   (fn  [o, datum]
 (let [casrn (.-casrn datum)
   common_name (.-common_name datum)]
   (js/alert (.-casrn datum))
   (update :casrn casrn)
   (update :common_name common_name)
   (.val (js/$ #common_name) common_name
 
 --
 Note that posts from new members are moderated - please be patient with your 
 first post.
 ---
 You received this message because you are subscribed to the Google Groups 
 ClojureScript group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to clojurescript+unsubscr...@googlegroups.com.
 To post to this group, send email to clojurescript@googlegroups.com.
 Visit this group at http://groups.google.com/group/clojurescript.
 
 
 -- 
 Note that posts from new members are moderated - please be patient with your 
 first post.
 --- 
 You received this message because you are subscribed to the Google Groups 
 ClojureScript group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to clojurescript+unsubscr...@googlegroups.com.
 To post to this group, send email to clojurescript@googlegroups.com.
 Visit this group at http://groups.google.com/group/clojurescript.
 
 
 -- 
 Note that posts from new members are moderated - please be patient with your 
 first post.
 --- 
 You received this message because you are subscribed to the Google Groups 
 ClojureScript group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to clojurescript+unsubscr...@googlegroups.com.
 To post to this group, send email to clojurescript@googlegroups.com.
 Visit this group at http://groups.google.com/group/clojurescript.
 
 -- 
 Note that posts from new members are moderated - please be patient with your 
 first post.
 --- 
 You received this message because you are subscribed to the Google Groups 
 ClojureScript group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to clojurescript+unsubscr...@googlegroups.com.
 To post to this group, send email to clojurescript@googlegroups.com.
 Visit this group at http://groups.google.com/group/clojurescript.

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
ClojureScript group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojurescript+unsubscr...@googlegroups.com.
To post to this group, send email to clojurescript@googlegroups.com.
Visit this group at http://groups.google.com/group/clojurescript.