Flushing to stdout doesn't seem to work anyway. Honestly have no idea how you'd implement it in Javascript so might have an ask on one of their forums...