jamwise
jamwise

Reputation: 175

In famous-angular, is there access to scrollview.sync.on(event)?

Right now I have a scrollview with fa-pipe-from from the surfaces in it and that works fine, and I've tried a few ways to listen in on the events from the scrollview.

One way was to add a fa-pipe-to to the scrollview

<fa-scroll-view fa-pipe-from="resultsViewHandler" fa-pipe-to="scrollViewHandler">

pointing to event handler

$scope.scrollViewHandler = new EventHandler();

but no events are coming from this handler

$scope.scrollViewHandler.on("start",function( e ){
    console.log( e ); 
}); // is never called

I've seen in another stackoverflow - link - question which suggested a solution that didn't work:

$famous.find('fa-scroll-view')[0].renderNode.sync.on('start', function(event) {
    console.log('start');
});

Any suggestions on how to achieve this?

EDIT: Apparently fa-pipe-to is working as expected, but the scrollview isn't emitting all events. The events that do work are: onEdge, offEdge, settle, pageChange and you can use them by piping the scrollview to an empty event handler like described above and listening to these events on it. The events that don't work are: start, update, end, resize and unfortunately are the ones I need the most.

Upvotes: 1

Views: 439

Answers (1)

user1857711
user1857711

Reputation: 117

Hey I answered that question in the link

I gave my scrollview an ID

<fa-scroll-view id="footer-scrollview" fa-pipe-from="footerScrollHandler"></fa-scroll-view>

And was able to listen to the events like so:

var scrollView = $famous.find('#footer-scrollview')[0].renderNode,
                scrollViewHandler = scrollView.sync
            ;
            scrollViewHandler.on('start', function(event) {
                console.log('start');
            });

'update' and 'end' events worked too. I also used a 2nd scrollview somewhere else in the app (w/ a different ID) and using the same strategy and it worked fine

Upvotes: 0

Related Questions