Switch state from within `after` callback