Merge pull request #1779 from rschamp/project-dirty-signal

Add "project changed" event
This commit is contained in:
Ray Schamp authored and GitHub committed 2018-11-27 08:54:30 -05:00
commit dd2023e2f3
3 files changed
+31 -4

No files matched your search

+4
View File
@@ -487,6 +487,10 @@ class Blocks {
}
break;
}
// forceNoGlow is set to true on containers that don't affect the project serialization,
// e.g., the toolbox or monitor containers.
if (optRuntime && !this.forceNoGlow) optRuntime.emitProjectChanged();
}
// ---------------------------------------------------------------------
+15 -1
View File
@@ -501,6 +501,14 @@ class Runtime extends EventEmitter {
return 'PROJECT_LOADED';
}
/**
* Event name for report that a change was made that can be saved
* @const {string}
*/
static get PROJECT_CHANGED () {
return 'PROJECT_CHANGED';
}
/**
* Event name for targets update report.
* @const {string}
@@ -1737,7 +1745,6 @@ class Runtime extends EventEmitter {
// Script glows must be cleared.
this._scriptGlowsPreviousFrame = [];
this._updateGlows();
this.requestTargetsUpdate(editingTarget);
}
/**
@@ -2035,6 +2042,13 @@ class Runtime extends EventEmitter {
this.emit(Runtime.PROJECT_LOADED);
}
/**
* Report that the project has changed in a way that would affect serialization
*/
emitProjectChanged () {
this.emit(Runtime.PROJECT_CHANGED);
}
/**
* Report that a new target has been created, possibly by cloning an existing target.
* @param {Target} newTarget - the newly created target.