Move polyfill to a named function for reuse by JS-clients