refactor onOnset and onRelease into onBoundary