diff options
author | Evgeny Zinoviev <me@ch1p.io> | 2023-09-13 09:34:49 +0300 |
---|---|---|
committer | Evgeny Sorokin <me@ch1p.io> | 2024-01-13 00:57:00 +0000 |
commit | 7058d0f5063dc9b065248d0a906cf874788caecf (patch) | |
tree | 26468a5d5a7f8c05804911b3fbf649d952bfd8f1 /localwebsite/htdocs/assets/h265webjs-dist/worker-fetch-dist.js | |
parent | 57955b596485ecce1ffd4395e23c078358cc5ddd (diff) |
save
Diffstat (limited to 'localwebsite/htdocs/assets/h265webjs-dist/worker-fetch-dist.js')
-rw-r--r-- | localwebsite/htdocs/assets/h265webjs-dist/worker-fetch-dist.js | 86 |
1 files changed, 0 insertions, 86 deletions
diff --git a/localwebsite/htdocs/assets/h265webjs-dist/worker-fetch-dist.js b/localwebsite/htdocs/assets/h265webjs-dist/worker-fetch-dist.js deleted file mode 100644 index e845d0e..0000000 --- a/localwebsite/htdocs/assets/h265webjs-dist/worker-fetch-dist.js +++ /dev/null @@ -1,86 +0,0 @@ -(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){ -"use strict"; - -// console.log("import raw worker!!!"); -function fetchData(url265) { - var fetchFinished = false; - var startFetch = false; - - if (!startFetch) { - startFetch = true; - fetch(url265).then(function (response) { - var pump = function pump(reader) { - return reader.read().then(function (result) { - if (result.done) { - // console.log("========== RESULT DONE ==========="); - fetchFinished = true; - postMessage({ - cmd: 'fetch-fin', - data: null, - msg: 'fetch-fin' - }); // window.clearInterval(networkInterval); - // networkInterval = null; - - return; - } - - var chunk = result.value; - postMessage({ - cmd: 'fetch-chunk', - data: chunk, - msg: 'fetch-chunk' - }); // rawParser.appendStreamRet(chunk); - - return pump(reader); - }); - }; - - return pump(response.body.getReader()); - })["catch"](function (error) { - console.log(error); - }); - } -} - -onmessage = function onmessage(event) { - // console.log("worker.onmessage", event); - var body = event.data; - var cmd = null; - - if (body.cmd === undefined || body.cmd === null) { - cmd = ''; - } else { - cmd = body.cmd; - } // console.log("worker recv cmd:", cmd); - - - switch (cmd) { - case 'start': - // console.log("worker start"); - var url = body.data; - fetchData(url); - postMessage({ - cmd: 'default', - data: 'WORKER STARTED', - msg: 'default' - }); - break; - - case 'stop': - // console.log("worker stop"); - // postMessage('WORKER STOPPED: ' + body); - close(); // Terminates the worker. - - break; - - default: - // console.log("worker default"); - // console.log("worker.body -> default: ", body); - // worker.postMessage('Unknown command: ' + data.msg); - break; - } - - ; -}; - -},{}]},{},[1]); |