From fad097d6ee6829b231885cadb55510a931955b15 Mon Sep 17 00:00:00 2001 From: Joel Date: Sun, 14 Jun 2015 12:59:24 -0600 Subject: [PATCH 1/2] Added a post reset optional parameter. --- lib/wptr.1.1.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/wptr.1.1.js b/lib/wptr.1.1.js index 60d648e..7b3e82f 100644 --- a/lib/wptr.1.1.js +++ b/lib/wptr.1.1.js @@ -19,7 +19,10 @@ var WebPullToRefresh = (function () { loadingFunction: false, // Dragging resistance level - resistance: 2.5 + resistance: 2.5, + + // Pointer to function that will be called post reset + postResetFunction: false }; /** @@ -55,7 +58,8 @@ var WebPullToRefresh = (function () { ptrEl: params.ptrEl || document.getElementById( defaults.ptrEl ), distanceToRefresh: params.distanceToRefresh || defaults.distanceToRefresh, loadingFunction: params.loadingFunction || defaults.loadingFunction, - resistance: params.resistance || defaults.resistance + resistance: params.resistance || defaults.resistance, + postResetFunction: params.postResetFunction || defaults.postResetFunction }; if ( ! options.contentEl || ! options.ptrEl ) { @@ -204,6 +208,11 @@ var WebPullToRefresh = (function () { }; document.body.addEventListener( 'transitionend', bodyClassRemove, false ); + + // If a post reset function has been defined, call it + if ( typeof(options.postResetFunction) === typeof(Function) ) { + options.postResetFunction(); + } }; return { From c2d4c445e43e5c068de897983ee3d65639f3c4b2 Mon Sep 17 00:00:00 2001 From: Joel Date: Sun, 14 Jun 2015 13:42:29 -0600 Subject: [PATCH 2/2] Updated documentation with new init parameter. --- README.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 55f1ead..af76f2f 100644 --- a/README.md +++ b/README.md @@ -77,8 +77,11 @@ There are a few optional parameters you can pass on initialization: // Number of pixels of dragging down until refresh will fire distanceToRefresh: 70, - // The dragging resistance level, the higher the more you'll need to drag down. - resistance: 2.5 + // The dragging resistance level, the higher the more you'll need to drag down. + resistance: 2.5, + + // Pointer to function that will be called post reset + postResetFunction: function() { } } ```