From fd43071a6c200c4ab6cd872136f359bd447b7dea Mon Sep 17 00:00:00 2001 From: Liooo Date: Wed, 28 Mar 2018 13:58:04 +0900 Subject: [PATCH] added showConsoleDebug option --- README.md | 1 + src/angular-vs-repeat.js | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 18b8be1..a8f4ce3 100644 --- a/README.md +++ b/README.md @@ -107,6 +107,7 @@ Options shall be passed as an object to the `vs-repeat` attribute e.g.: - `scrolled-to-end-offset` - set this number to trigger the scrolledToEnd callback n items before the last gets rendered - `scrolled-to-beginning` - callback will be called when the first item of the list is rendered - `scrolled-to-beginning-offset` - set this number to trigger the scrolledToBeginning callback n items before the first gets rendered +- `show-console-debug` - if false, suppresses debug messages in console (defaults to true) ### EVENTS: - `vsRepeatTrigger` - an event the directive listens for to manually trigger reinitialization diff --git a/src/angular-vs-repeat.js b/src/angular-vs-repeat.js index 81c4503..e3f890f 100644 --- a/src/angular-vs-repeat.js +++ b/src/angular-vs-repeat.js @@ -74,6 +74,7 @@ * `scrolled-to-end-offset` - set this number to trigger the scrolledToEnd callback n items before the last gets rendered * `scrolled-to-beginning` - callback will be called when the first item of the list is rendered * `scrolled-to-beginning-offset` - set this number to trigger the scrolledToBeginning callback n items before the first gets rendered + * `show-console-debug` - if false, suppresses debug messages in console (defaults to true) * EVENTS: * - `vsRepeatTrigger` - an event the directive listens for to manually trigger reinitialization @@ -182,6 +183,7 @@ autoresize: false, hunked: false, hunkSize: 0, + showConsoleDebug: true, }; const vsRepeatModule = angular.module('vs-repeat', []).directive('vsRepeat', ['$compile', '$parse', function($compile, $parse) { @@ -568,7 +570,7 @@ __startIndex = 0; __endIndex = 1; } else { - _warnMismatch(); + if(options.showConsoleDebug) { _warnMismatch(); } const relativeScroll = $scrollPosition - options.offsetBefore - scrollOffset;