How to use PAC script in addons

What is the recommended way of using remote PAC script now that proxy.register() is set to be depreciated ?

I am trying to port a chrome extension to firefox

As you said, register/unregister are currently depreciated and going away in Firefox 71, to be released on December 10th, 2019.

As an alternative, you can use the proxy.onRequest API to determine how requests will be handled, and proxy.onError to handle failures.

Reference : https://blog.mozilla.org/addons/2019/06/13/extensions-in-firefox-68/

Thanks @sylvaing for the quick response

Can you show me an example of how to consume a PAC script with the new API