apache / cordova-ios

Apache Cordova iOS
https://cordova.apache.org/
Apache License 2.0
2.16k stars 987 forks source link

IntersectionObserver experimental support in iOS? #884

Closed LordPachelbel closed 4 years ago

LordPachelbel commented 4 years ago

IntersectionObserver is enabled by default in iOS Safari's Experimental Features list, but it doesn't seem to work in a Cordova app:

let observer = new IntersectionObserver(entries => {
  if (entries[0].boundingClientRect.y < 0) {
    document.body.classList.add("header-not-at-top");
  } else {
    document.body.classList.remove("header-not-at-top");
  }
});
observer.observe(document.querySelector("#top-of-site-pixel-anchor"));

The new line throws an exception: ReferenceError: Can't find variable: IntersectionObserver

It probably doesn't work for the same reason WebGL2 stuff doesn't work, right?

breautek commented 4 years ago

It probably doesn't work for the same reason WebGL2 stuff doesn't work, right?

Correct, experimental features are not enabled in app webviews, so they cannot be used.