Move global node interfaces to NodeJS module

Rebase & fixes for #2020