Search code examples
ffireasonbucklescript

Binding to window.navigator.getUserMedia


[@bs.module] external navigator: unit = "window.navigator";

giving following error Module not found: Can't resolve 'window.navigator'

How to access the windows.navigator in ReasonML?


Solution

  • window.navigator is not a module, but a "global value", so you should use @bs.val instead:

    [@bs.val] external navigator: unit = "window.navigator";
    

    See the documentation on how to Bind to Global Values for more details.