Merge branch 'record' of https://github.com/CendioOssman/noVNC
This commit is contained in:
commit
39193b2878
|
@ -19,10 +19,17 @@ function loadFile() {
|
||||||
}
|
}
|
||||||
|
|
||||||
message("Loading " + fname);
|
message("Loading " + fname);
|
||||||
return import(`../recordings/${fname}#nocache`);
|
|
||||||
|
return new Promise(function (resolve, reject) {
|
||||||
|
var script = document.createElement("script");
|
||||||
|
script.onload = resolve;
|
||||||
|
script.onerror = reject;
|
||||||
|
document.body.appendChild(script);
|
||||||
|
script.src = "../recordings/" + fname;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function enableUI(recording) {
|
function enableUI() {
|
||||||
var iterations = WebUtil.getQueryVar('iterations', 3);
|
var iterations = WebUtil.getQueryVar('iterations', 3);
|
||||||
document.getElementById('iterations').value = iterations;
|
document.getElementById('iterations').value = iterations;
|
||||||
|
|
||||||
|
@ -33,14 +40,14 @@ function enableUI(recording) {
|
||||||
document.getElementById('mode1').checked = true;
|
document.getElementById('mode1').checked = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
message("VNC_frame_data.length: " + recording.VNC_frame_data.length);
|
message("VNC_frame_data.length: " + VNC_frame_data.length);
|
||||||
|
|
||||||
const startButton = document.getElementById('startButton');
|
const startButton = document.getElementById('startButton');
|
||||||
startButton.disabled = false;
|
startButton.disabled = false;
|
||||||
startButton.addEventListener('click', start);
|
startButton.addEventListener('click', start);
|
||||||
|
|
||||||
frames = recording.VNC_frame_data;
|
frames = VNC_frame_data;
|
||||||
encoding = recording.VNC_frame_encoding;
|
encoding = VNC_frame_encoding;
|
||||||
}
|
}
|
||||||
|
|
||||||
const notification = function (rfb, mesg, level, options) {
|
const notification = function (rfb, mesg, level, options) {
|
||||||
|
@ -171,4 +178,4 @@ function start() {
|
||||||
player.start(mode);
|
player.start(mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
loadFile().then(enableUI).catch(message);
|
loadFile().then(enableUI).catch(function (e) { message("Error loading recording"); });
|
||||||
|
|
|
@ -1297,6 +1297,7 @@ function xhrFetch(url, resolve, reject) {
|
||||||
}
|
}
|
||||||
|
|
||||||
var WorkerPool = function (script, size) {
|
var WorkerPool = function (script, size) {
|
||||||
|
script = document.currentScript.src.substr(0, document.currentScript.src.lastIndexOf("/")) + "/" + script;
|
||||||
this._workers = new Array(size);
|
this._workers = new Array(size);
|
||||||
this._ind = 0;
|
this._ind = 0;
|
||||||
this._size = size;
|
this._size = size;
|
||||||
|
@ -1364,7 +1365,7 @@ WorkerPool.prototype = {
|
||||||
};
|
};
|
||||||
|
|
||||||
var promiseMap = new Map();
|
var promiseMap = new Map();
|
||||||
var babelWorker = new WorkerPool('vendor/browser-es-module-loader/dist/babel-worker.js', 3);
|
var babelWorker = new WorkerPool('babel-worker.js', 3);
|
||||||
babelWorker.onmessage = function (evt) {
|
babelWorker.onmessage = function (evt) {
|
||||||
var promFuncs = promiseMap.get(evt.data.key);
|
var promFuncs = promiseMap.get(evt.data.key);
|
||||||
promFuncs.resolve(evt.data);
|
promFuncs.resolve(evt.data);
|
||||||
|
@ -1405,7 +1406,6 @@ BrowserESModuleLoader.prototype[RegisterLoader$1.instantiate] = function(key, pr
|
||||||
}).then(function (data) {
|
}).then(function (data) {
|
||||||
// evaluate without require, exports and module variables
|
// evaluate without require, exports and module variables
|
||||||
// we leave module in for now to allow module.require access
|
// we leave module in for now to allow module.require access
|
||||||
if (data.key.slice(-8) !== '#nocache') {
|
|
||||||
try {
|
try {
|
||||||
var cacheEntry = JSON.stringify({source: data.source, code: data.code});
|
var cacheEntry = JSON.stringify({source: data.source, code: data.code});
|
||||||
localStorage.setItem(key, cacheEntry);
|
localStorage.setItem(key, cacheEntry);
|
||||||
|
@ -1414,7 +1414,6 @@ BrowserESModuleLoader.prototype[RegisterLoader$1.instantiate] = function(key, pr
|
||||||
window.console.warn('Unable to cache transpiled version of ' + key + ': ' + e);
|
window.console.warn('Unable to cache transpiled version of ' + key + ': ' + e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
(0, eval)(data.code + '\n//# sourceURL=' + data.key + '!transpiled');
|
(0, eval)(data.code + '\n//# sourceURL=' + data.key + '!transpiled');
|
||||||
processAnonRegister();
|
processAnonRegister();
|
||||||
});
|
});
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -137,6 +137,7 @@ function xhrFetch(url, resolve, reject) {
|
||||||
}
|
}
|
||||||
|
|
||||||
var WorkerPool = function (script, size) {
|
var WorkerPool = function (script, size) {
|
||||||
|
script = document.currentScript.src.substr(0, document.currentScript.src.lastIndexOf("/")) + "/" + script;
|
||||||
this._workers = new Array(size);
|
this._workers = new Array(size);
|
||||||
this._ind = 0;
|
this._ind = 0;
|
||||||
this._size = size;
|
this._size = size;
|
||||||
|
@ -204,7 +205,7 @@ WorkerPool.prototype = {
|
||||||
};
|
};
|
||||||
|
|
||||||
var promiseMap = new Map();
|
var promiseMap = new Map();
|
||||||
var babelWorker = new WorkerPool('vendor/browser-es-module-loader/dist/babel-worker.js', 3);
|
var babelWorker = new WorkerPool('babel-worker.js', 3);
|
||||||
babelWorker.onmessage = function (evt) {
|
babelWorker.onmessage = function (evt) {
|
||||||
var promFuncs = promiseMap.get(evt.data.key);
|
var promFuncs = promiseMap.get(evt.data.key);
|
||||||
promFuncs.resolve(evt.data);
|
promFuncs.resolve(evt.data);
|
||||||
|
@ -245,7 +246,6 @@ BrowserESModuleLoader.prototype[RegisterLoader.instantiate] = function(key, proc
|
||||||
}).then(function (data) {
|
}).then(function (data) {
|
||||||
// evaluate without require, exports and module variables
|
// evaluate without require, exports and module variables
|
||||||
// we leave module in for now to allow module.require access
|
// we leave module in for now to allow module.require access
|
||||||
if (data.key.slice(-8) !== '#nocache') {
|
|
||||||
try {
|
try {
|
||||||
var cacheEntry = JSON.stringify({source: data.source, code: data.code});
|
var cacheEntry = JSON.stringify({source: data.source, code: data.code});
|
||||||
localStorage.setItem(key, cacheEntry);
|
localStorage.setItem(key, cacheEntry);
|
||||||
|
@ -254,7 +254,6 @@ BrowserESModuleLoader.prototype[RegisterLoader.instantiate] = function(key, proc
|
||||||
window.console.warn('Unable to cache transpiled version of ' + key + ': ' + e);
|
window.console.warn('Unable to cache transpiled version of ' + key + ': ' + e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
(0, eval)(data.code + '\n//# sourceURL=' + data.key + '!transpiled');
|
(0, eval)(data.code + '\n//# sourceURL=' + data.key + '!transpiled');
|
||||||
processAnonRegister();
|
processAnonRegister();
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue