pagerjs icon indicating copy to clipboard operation
pagerjs copied to clipboard

Successful route notification?

Open kokujin opened this issue 12 years ago • 3 comments

I would like to be notified when a routing was successful. I tried "afterShow" but I assume that I am not using it properly because I cannot seem to catch the event:

pager.page.afterShow = function(){ console.log('after show'); // Do some other things... }

Any ideas? Thanks

kokujin avatar Mar 11 '13 10:03 kokujin

Hm... strange. I dont remember if afterShow trigger on the global pager object or only on page objects at the moment. I guess there should be a navigationSuccess callback/event too that triggers whenever navigationFailed doesnt trigger. Some events on pager are $.Callbacks() and some are ko.observables (will be converted to $.Callbacks() ). Maybe you need

pager.afterShow.add(...)

Sent from my iPhone

On Mar 11, 2013, at 11:40, kokujin [email protected] wrote:

I would like to be notified when a routing was successful. I tried "afterShow" but I assume that I am not using it properly because I cannot seem to catch the event:

pager.page.afterShow = function(){ console.log('after show'); // Do some other things... }

Any ideas? Thanks

— Reply to this email directly or view it on GitHub.

finnsson avatar Mar 11 '13 17:03 finnsson

hmm.. strange, its not declared as a function in the source...pager.afterShow does not exist

kokujin avatar Mar 11 '13 23:03 kokujin

Just want to make sure this issue is fixed before I close it. OK?

As for the source it's declared in a loop:

$.each(['onBindingError', 'onSourceError', 'onNoMatch', 'onMatch',
        'beforeRemove', 'afterRemove',
        'beforeHide', 'afterHide',
        'beforeShow', 'afterShow'], function (i, n) {
        pager[n] = $.Callbacks();
  });

in order to save some bytes (I'm trying to keep pagerjs under 5kb minified and gzipped).

finnsson avatar Jun 26 '13 07:06 finnsson