From 702407a098a8ca0ea82aec68467db1b5b4378759 Mon Sep 17 00:00:00 2001 From: MuK IT GmbH Date: Thu, 7 Mar 2019 10:01:52 +0000 Subject: [PATCH] publish muk_web_utils - 12.0 --- muk_web_utils/__manifest__.py | 2 +- .../static/src/js/libs/underscore.js | 44 +++++++++++++++++++ muk_web_utils/template/assets.xml | 1 + 3 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 muk_web_utils/static/src/js/libs/underscore.js diff --git a/muk_web_utils/__manifest__.py b/muk_web_utils/__manifest__.py index ca6c8d2..dbc362e 100644 --- a/muk_web_utils/__manifest__.py +++ b/muk_web_utils/__manifest__.py @@ -20,7 +20,7 @@ { "name": "MuK Web Utils", "summary": """Utility Features""", - "version": "12.0.2.8.19", + "version": "12.0.2.8.20", "category": "Extra Tools", "license": "AGPL-3", "author": "MuK IT", diff --git a/muk_web_utils/static/src/js/libs/underscore.js b/muk_web_utils/static/src/js/libs/underscore.js new file mode 100644 index 0000000..5901f96 --- /dev/null +++ b/muk_web_utils/static/src/js/libs/underscore.js @@ -0,0 +1,44 @@ +/********************************************************************************** +* +* Copyright (C) 2018 MuK IT GmbH +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Affero General Public License as +* published by the Free Software Foundation, either version 3 of the +* License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Affero General Public License for more details. +* +* You should have received a copy of the GNU Affero General Public License +* along with this program. If not, see . +* +**********************************************************************************/ + +_.mixin({ + memoizeDebounce: function(func, wait, options) { + wait = (typeof wait !== 'undefined') ? wait : 0; + options = (typeof options !== 'undefined') ? options : {}; + var mem = _.memoize(function() { + return _.debounce(func, wait, options) + }, options.resolver); + return function() { + mem.apply(this, arguments).apply(this, arguments) + } + } +}); + +_.mixin({ + memoizeThrottle: function(func, wait, options) { + wait = (typeof wait !== 'undefined') ? wait : 0; + options = (typeof options !== 'undefined') ? options : {}; + var mem = _.memoize(function() { + return _.throttle(func, wait, options) + }, options.resolver); + return function() { + mem.apply(this, arguments).apply(this, arguments) + } + } +}); \ No newline at end of file diff --git a/muk_web_utils/template/assets.xml b/muk_web_utils/template/assets.xml index edd3a51..e04ce8d 100644 --- a/muk_web_utils/template/assets.xml +++ b/muk_web_utils/template/assets.xml @@ -27,6 +27,7 @@