mirror of
https://github.com/4ian/GDevelop.git
synced 2025-10-15 10:19:04 +00:00
[WIP] Fix memory leak when receiving data in newIDE, add smooth startup transition
This commit is contained in:
@@ -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),
|
||||
|
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user