Can I use the Web Animations API?


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?


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.


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


The discussion link you posted led me down a search path that helped me find the experimentalFeatures option for BrowserWindow:

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