Allow setting onRemove function