babel-service
demo (tested on Chrome, Chrome Canary and Opera)
On demand targeted transpiling inside the browser's ServiceWorker
Can you add the second default value? + =
Instructions
Take a look at app.js below. Depending on the browser,
the code for handling the default parameter will be either transpiled or
not. The ServiceWorker running on this page tests the browser support
for ES6 default parameters and then either passes through the original
source, or transpiles this feature.
Demo source, including screenshots at
bahmutov/babel-service-demo
and it uses babel-service
library inside the ServiceWorker to intercept application code, test ES6 support
and selectively transpile.
Source received (via ServiceWorker) for app.js
The code might show add (a, b = 1) if your browser natively supports
default parameters. Or it might show transpiled version if browser does not