Can I use the Web Animations API?


#1

I need to control CSS animations using the Web Animations API. Specifically I need to be able to use DocumentTimeline and call document.timeline.getAnimations()

DocumentTimeline doesn’t seem to exist in Electron and thus I can’t call document.timeline. Is there any way to enable this?


#2

According to MDN, document.timeline is an experimental feature and there is no support for it in Chrome. Electron is based on Chromium, the open source part of Chrome, so that is why there is no support for it.

This discussion is all I could find referencing Chrome support for the Web Animations API.


#3

I’m using it in Chrome. I need to be able to use it server-side though.


#4

The discussion link you posted led me down a search path that helped me find the experimentalFeatures option for BrowserWindow: https://github.com/electron/electron/blob/master/docs/api/browser-window.md

I was able to get access to document.timeline by instantiating my BrowserWindow like this:

new BrowserWindow({ webPreferences: { experimentalFeatures: true } })

I cross-posted the solution to the other discussion item that helped me find the right thing: How to enable Experimental Web Platform Features