Split core utilities from tma.js to src/core.js

tma.js keeps compatibility, but tma.js depends much on src/core.js so
that tma.js specific code is minimized.

Some part of core utilities are rewritten to use Promise. It results in
loading multiple scripts in parallel with minimal efforts. It reduce
loading time by almost 50%.