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 | (function() { // BEGIN LOCAL_SCOPE | 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 | // Set up the qml ui | 21 | // Set up the qml ui |
| 14 | var qml = Script.resolvePath('debugWindow.qml'); | 22 | var qml = Script.resolvePath('debugWindow.qml'); |
| 23 | |||
| 15 | var window = new OverlayWindow({ | 24 | var window = new OverlayWindow({ |
| 16 | title: 'Debug Window', | 25 | title: 'Debug Window', |
| 17 | source: qml, | 26 | source: qml, |
| 18 | width: 400, height: 900, | 27 | width: 400, height: 900, |
| 19 | }); | 28 | }); |
| 29 | |||
| 20 | window.setPosition(25, 50); | 30 | window.setPosition(25, 50); |
| 21 | window.closed.connect(function() { Script.stop(); }); | 31 | window.closed.connect(function() { Script.stop(); }); |
| 22 | 32 | ||