Terminal control/Preserve screen

From Rosetta Code
Revision as of 19:31, 21 March 2011 by Rdm (talk | contribs) (Tentative Javascript implementation (assumes browser environment))
Terminal control/Preserve screen is a draft programming task. It is not yet considered ready to be promoted as a complete task, for reasons that should be found in its talk page.

The task is to clear the screen, output something on the display, and then restore the screen to the preserved state that it was in before the task was carried out.


JavaScript

<lang javascript>(function tcps() { var orig= document.body.innerHTML document.body.innerHTML= ; setTimeout(function() { document.body.innerHTML= 'something' setTimeout(function() { document.body.innerHTML= orig; }, 1000); }, 1000); })(); </lang>

This implementation assumes that Javascript is running in the browser.

This task does not admit sample output, but you can demonstrate this solution for yourself using the chrome browser: control-shift-J then copy and paste the above into the command line, and hit enter.