In a modified version of this that I changed, I added the ability to pass in two new options: shouldPinCheck and shouldUnpinCheck (couldn't think of better names). These are functions that must return true/false. They are fired inside the shouldPin/shouldUnpin functions in the return statement.
Therefore, if a headroom goes to unpin and the shouldUnpinCheck returns false, the headroom element shouldn't be unpinned. Same thing for the shouldPinCheck but opposite.
If it was useful to me, I thought it may be useful to someone else as well. Maybe this should be added into the codebase.