made scope test optional...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2020-12-15 05:08:06 +03:00
parent cdbdf130de
commit 4f3476ec1a
3 changed files with 18 additions and 16 deletions

View File

@ -9,13 +9,14 @@
**********************************************************************/ **********************************************************************/
// Global scope pollution test... // Global scope pollution test...
global.__global = {...global} if(process.env.IMAGEGRID_DEBUG){
global.scopeDiff = function(cur=global, base=__global){ global.__global = {...global}
return Object.keys(cur) global.scopeDiff = function(cur=global, base=__global){
.filter(function(k){ return base[k] !== cur[k] }) return Object.keys(cur)
.reduce(function(res, k){ .filter(function(k){ return base[k] !== cur[k] })
res[k] = cur[k] .reduce(function(res, k){
return res }, {})} res[k] = cur[k]
return res }, {})} }
/*********************************************************************/ /*********************************************************************/

View File

@ -9,13 +9,14 @@
//var DEBUG = DEBUG != null ? DEBUG : true //var DEBUG = DEBUG != null ? DEBUG : true
// Global scope pollution test... // Global scope pollution test...
global.__global = global.__global || {...global} if(process.env.IMAGEGRID_DEBUG){
global.scopeDiff = function(cur=global, base=__global){ global.__global = global.__global || {...global}
return Object.keys(cur) global.scopeDiff = function(cur=global, base=__global){
.filter(function(k){ return base[k] !== cur[k] }) return Object.keys(cur)
.reduce(function(res, k){ .filter(function(k){ return base[k] !== cur[k] })
res[k] = cur[k] .reduce(function(res, k){
return res }, {})} res[k] = cur[k]
return res }, {})} }
/*********************************************************************/ /*********************************************************************/

View File

@ -31,7 +31,7 @@
<!-- Scripts --> <!-- Scripts -->
<!-- Global scope pollution test --> <!-- Global scope pollution test -->
<script> <!--script>
var __window = {...window} var __window = {...window}
function scopeDiff(cur=window, base=__window){ function scopeDiff(cur=window, base=__window){
return Object.keys(cur) return Object.keys(cur)
@ -40,7 +40,7 @@ function scopeDiff(cur=window, base=__window){
.reduce(function(res, k){ .reduce(function(res, k){
res[k] = cur[k] res[k] = cur[k]
return res }, {})} return res }, {})}
</script> </script-->
<!-- DevTools fail-safe for electron/nw... --> <!-- DevTools fail-safe for electron/nw... -->
<script> <script>