Skip to content

You're viewing documentation for a pre-release version. View the latest stable version

Instance Method

pushEphemeral()

Pushes a new ephemeral console state. All text outputted to the console immidiately after this call can be cleared by using popEphemeral().
func pushEphemeral()

Discussion

This method can be called as many times as desired. Calls to popEphemeral() will work in reverse order.

console.print("a")
console.pushEphemeral()
console.print("b")
console.print("c")
console.pushEphemeral()
console.print("d")
console.print("e")
console.print("f")
console.popEphemeral() // removes "d", "e", and "f" lines
console.print("g")
console.popEphemeral() // removes "b", "c", and "g" lines
// just "a" has been printed now