Showing the changes to scripts/developer/debugging/debugWindow.js (1 of 3 files). Show all
Unified · Split
| @@ -10,13 +10,23 @@ · 9 unmodified lines | ||
| 10 | 10 | |
| 11 | 11 | (function() { // BEGIN LOCAL_SCOPE |
| 12 | 12 | |
| 13 | +//check if script already running. | |
| 14 | +var scriptData = ScriptDiscoveryService.getRunning(); | |
| 15 | +var scripts = scriptData.filter(function (datum) { return datum.name === 'debugWindow.js'; }); | |
| 16 | +if (scripts.length >= 2) { | |
| 17 | + //2nd instance of the script is too much | |
| 18 | + return; | |
| 19 | +} | |
| 20 | + | |
| 13 | 21 | // Set up the qml ui |
| 14 | 22 | var qml = Script.resolvePath('debugWindow.qml'); |
| 23 | + | |
| 15 | 24 | var window = new OverlayWindow({ |
| 16 | 25 | title: 'Debug Window', |
| 17 | 26 | source: qml, |
| 18 | 27 | width: 400, height: 900, |
| 19 | 28 | }); |
| 29 | + | |
| 20 | 30 | window.setPosition(25, 50); |
| 21 | 31 | window.closed.connect(function() { Script.stop(); }); |
| 22 | 32 | |