Home > @theatre/studio > IStudio > scrub
# IStudio.scrub() method
Creates a scrub, which is just like a transaction, except you can run it multiple times without creating extra undo levels.
Signature:
scrub(): IScrub;
Returns:
# Example
Usage:
const scrub = studio.scrub()
scrub.capture(({set}) => {
set(obj.props.x, 10) // set the value of obj.props.x to 10
})
// half a second later...
scrub.capture(({set}) => {
set(obj.props.y, 11) // set the value of obj.props.y to 11
// note that since we're not setting obj.props.x, its value reverts back to its old value (ie. not 10)
})
// then either:
scrub.commit() // commits the scrub and creates a single undo level
// or:
scrub.reset() // clear all the ops in the scrub so we can run scrub.capture() again
// or:
scrub.discard() // clears the ops and destroys it (ie. can't call scrub.capture() anymore)