Using Console.clear


#1

My question is quite simple. Is there a way that I can use the console.clear() function? If not, is there a package with reason bindings that I can use? I’ve tried my classic way of printing out ASCII value “\u001b[H\u001b[2J”, which usually works in languages like C++ and Java, but not in Reason.

Any help would be appreciated.


#2

Yes, there is. It requires writing a binding to that function.

You can find more general information concerning how to accomplish this here.

In your specific case, this will work:
@bs.val @bs.scope("console") external clear: unit => unit = "clear";


#3

Thank you very much for the bindings, sir