0

My d3.js graphs are not showing correctly when I access my website with Chrome on my iPhone 6s.

It seems to be because I use ES6 syntax (arrow functions).

But if I check http://caniuse.com/#feat=arrow-functions, it says that Chrome does support arrow functions. The website hasn't listed Chrome for iOS, but should it make a big difference?

If arrow functions are not supported, does it also mean that I cannot use Array.map(), Array.forEach(), etc?

Jamgreen
  • 10,329
  • 29
  • 113
  • 224

1 Answers1

4

Chrome for iOS has some pretty major technical restrictions imposed by the App Store, such as the requirement to use the built-in UIWebView for rendering, no V8, and a single-process model. As a result it’s been challenging to re-use critical Chromium infrastructure components. That said, there is a lot of code we do leverage, such as the network layer, the sync and bookmarks infrastructure, omnibox, metrics and crash reporting, and a growing portion of content.

Source: https://groups.google.com/a/chromium.org/forum/?fromgroups#!topic/chromium-dev/vYGxPx-tVKE

But if I check http://caniuse.com/#feat=arrow-functions, it says that Chrome does support arrow functions. The website hasn't listed Chrome for iOS, but should it make a big difference?

So, you might check whether the features you're looking for are supported or not, for iOS Safari not for Chrome. Chrome in iOS is not using the same rendering engine as it is in desktop machines.

You better, compile your code before releasing it to production with babel.js for example. This way, you can write your code as anyway you like and then deploy it to the platforms with graceful degradation.

Does it also mean that I cannot use Array.map(), Array.forEach(), etc?

Array.map, Array.forEach are from ES5 and ES5 is widely supported. Just try, I think that they will work.

Inanc Gumus
  • 25,195
  • 9
  • 85
  • 101
  • Thank you :-) I have changed my arrow functions now, but it still doesn't work with my current code. I have experienced this before where removing the arrow functions solved the problem. But now I have very much code to debug. Do you know a tool to test it? I guess it has some javascript error, but I cannot find a developer tab on my iPhone – Jamgreen Sep 03 '16 at 22:12
  • Np:) Here is some tips on how to do that: https://stackoverflow.com/questions/11262236/ios-remote-debugging/22047495#22047495 – Inanc Gumus Sep 03 '16 at 22:15