jslib: Move instance initialization

Do not initialize variable too early. They're set either on window
or attempted to be done on undefined - which causes crash.