Add partially-functioning ternJS support

See issue #140