Is it possible to detach functions in javascript while allowing them to retain access to their context?
For example suppose we have a ViewportScroller
instance called vc. We can get the current scroll position by calling:
vc.getScrollPosition()
Is it possible to detach it like this:
cont scrollPosition = vc.getScrollPosition
While ensuring that it will still work and be able to access everything it needs to work or do we always need to wrap vc
like this:
const scrollPostion = ()=>vc.getScrollPosition()