[WIP] Fix memory leak when receiving data in newIDE, add smooth startup transition

This commit is contained in:
Florian Rival
2017-03-03 00:37:50 +01:00
parent a29332e4dc
commit 8709de1e3e
3 changed files with 21 additions and 4 deletions

View File

@@ -15,8 +15,19 @@ html, body {
flex: 1;
display: flex;
flex-direction: column;
/* Smoother startup */
animation: fadein 0.5s;
}
@keyframes fadein {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
/* Disable selections and web-ish cursors */
:not(input):not(textarea),

View File

@@ -60,6 +60,8 @@ Bridge.prototype.send = function(command, serializedObject, scope = "") {
Bridge.prototype._receive = function(data) {
console.log("Received data");
// Parse the received JSON
var t0 = performance.now();
var dataObject;
try {
@@ -69,13 +71,17 @@ Bridge.prototype._receive = function(data) {
return;
}
var t1 = performance.now();
var serializedObject = gd.Serializer.fromJSObject(dataObject.payload);
// Transform the payload into a gd.SerializerElement
// Note that gd.Serializer.fromJSObject returns a new gd.SerializerElement object at every call
if (this._serializedObject) this._serializedObject.delete();
this._serializedObject = gd.Serializer.fromJSObject(dataObject.payload);
var t2 = performance.now();
console.log("JSON parse took " + (t1 - t0) + " milliseconds.");
console.log("Call to gd.Serializer.fromJSObject took " + (t2 - t1) + " milliseconds.");
if (this._onReceiveCb) {
this._onReceiveCb(dataObject.command, serializedObject, dataObject.scope);
this._onReceiveCb(dataObject.command, this._serializedObject, dataObject.scope);
}
}

View File

@@ -4,7 +4,7 @@ if ! [ -f "node_modules/.bin/build" ]; then
exit
fi
# npm run build:app
npm run build:app
rm -rf app/www
mkdir -p app/www