From 40561952d1ef35912e97a7ea78d93583ac371f5b Mon Sep 17 00:00:00 2001 From: twobiers <22715034+twobiers@users.noreply.github.com> Date: Thu, 6 Jul 2023 17:32:45 +0200 Subject: [PATCH] temporary fix to prevent calling api too often --- src/EventHandler.js | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/src/EventHandler.js b/src/EventHandler.js index 204dde7..9cb2a80 100644 --- a/src/EventHandler.js +++ b/src/EventHandler.js @@ -21,27 +21,31 @@ export default class EventHandler { (function (loaded) { p.View.Stream.Main.prototype.loaded = function (items, position, error) { - loaded.call(this, items, position, error); - _this.streamLoaded.data = { - items, - position, - error - }; - window.dispatchEvent(_this.streamLoaded); - - logger.debug("[E] StreamLoaded: ", _this.streamLoaded); + if(p.currentView.classId === 26) { + loaded.call(this, items, position, error); + _this.streamLoaded.data = { + items, + position, + error + }; + window.dispatchEvent(_this.streamLoaded); + + logger.debug("[E] StreamLoaded: ", _this.streamLoaded); + } }; }(p.View.Stream.Main.prototype.loaded)); (function (load) { p.Stream.prototype._load = function (options, callback) { - load.call(this, options, callback); - _this.loadStreamContent.data = { - options - }; - window.dispatchEvent(_this.loadStreamContent); - - logger.debug("[E] Stream Items Loaded: ", _this.loadStreamContent); + if(p.currentView.classId === 26) { + load.call(this, options, callback); + _this.loadStreamContent.data = { + options + }; + window.dispatchEvent(_this.loadStreamContent); + + logger.debug("[E] Stream Items Loaded: ", _this.loadStreamContent); + } }; }(p.Stream.prototype._load));