Basic function.js split

Needed for #3474