var test;
var Stream = {
    template: '',
    start: function (url, mixer_url, twitch_url) {
        twitch_url = twitch_url.replace("_/", '');
        mixer_url = mixer_url.replace("_/", '');
        this.template = '<a class="carousel-item hoverable" href="' + twitch_url + '{{ 0 }}">' +
            '<img src="https://static-cdn.jtvnw.net/previews-ttv/live_user_{{ 1 }}-640x360.jpg"' +
            ' alt="{{ 0 }}"></a>';
        if (localStorage['timestamp'] < Date.now() - 60)
            $.get(url, function (data, status) {
                test = data;
                localStorage['timestamp'] = Date.now();
                localStorage['streamData'] = JSON.stringify(data);
            });
        Stream.generate(JSON.parse(localStorage['streamData']), mixer_url, twitch_url);
    },
    generate: function (data) {
        for (var i = 0; i < data.length; i++) {
            console.log('dupa');
            $(".stream-container .carousel").append(Mustache.render(this.template, data[i]));
        }
        $('.carousel.carousel-slider').carousel({fullWidth: true});
        $('.carousel').carousel();
    }
};
@@ -83,24 +83,59 @@
 itch_url) %7B%0A
+        this.checkExistsStorage();%0A
         twit
@@ -165,32 +165,32 @@
 lace(%22_/%22, '');%0A
-
         mixer_ur
@@ -739,24 +739,29 @@
     
-Stream.generate(
+var jsonStreamData = 
 JSON
@@ -794,16 +794,56 @@
 mData'%5D)
+;%0A        Stream.generate(jsonStreamData
 , mixer_
@@ -951,41 +951,8 @@
 ) %7B%0A
-            console.log('dupa');%0A
     
@@ -1115,24 +1115,24 @@
 th: true%7D);%0A
-
         $('.
@@ -1150,20 +1150,312 @@
 carousel();%0A
+    %7D,%0A    checkExistsStorage: function () %7B%0A        if (typeof localStorage%5B'streamData'%5D === 'undefined') %7B%0A            localStorage%5B'streamData'%5D='';%0A        %7D%0A%0A        if (typeof localStorage%5B'timestamp'%5D === 'undefined')%7B%0A            localStorage%5B'timestamp'%5D=Date.now()/1000;%0A        %7D%0A
     %7D%0A%7D;

stream.js errors