Refactor: removed unused code from zabbixCachingProxy.

This commit is contained in:
Alexander Zobnin
2016-11-14 22:36:21 +03:00
parent f56c4c66d6
commit 9392d45ad9
2 changed files with 23 additions and 62 deletions

View File

@@ -93,6 +93,25 @@ export function convertToZabbixAPIUrl(url) {
}
}
/**
* Wrap function to prevent multiple calls
* when waiting for result.
*/
export function callOnce(func, promiseKeeper) {
return function() {
if (!promiseKeeper) {
promiseKeeper = Promise.resolve(
func.apply(this, arguments)
.then(result => {
promiseKeeper = null;
return result;
})
);
}
return promiseKeeper;
};
}
// Fix for backward compatibility with lodash 2.4
if (!_.includes) {
_.includes = _.contains;