temporary onEnd() function