Closed rasom closed 7 years ago
Well it's pretty obvious we are going to have to start moving to an idea of traits rather than going by an environment.
But for now I'd like to have a react-native-env?
and a :react-native
key returned by host-env?
And then look for the spots that are using (html-env?)
as a behavior switch and include react native as needed.
Ideally if you find a spot that is testing for (html-env?)
that needs to include react-native
then it would be best to create a function that tests for the trait that is being looked for
(defn trait-console? [] (exists? js/console))
(defn trait-console-warn? [] (and (trait-console?) (exists? js/console.warn))
How does that sound?
Those trait functions would go in the utils.cljs
Thanks, @bhauman, sounds reasonable.
I've just added updates in another commit, let's see if I understand you correctly.
The only other thing I worry about, is if goog.global.navigator will exist in all environments?
The only other thing I worry about, is if goog.global.navigator will exist in all environments?
You are right, I'm not sure that it exists in all environments
@rasom I got this same problem when using React Native with Exponent exponent-cljs-template, so thanks for your work.
I've tested goog.global.navigator
on these 4 environments:
goog.global.navigator.product
equals to react-native
.
Currently
lein-figwheel >= 0.5.9
crashes withReload not defined for this platform
error message in React Native applications (re-natal). This commit fixes the problem.