|
@ -9,11 +9,11 @@ addEventListener("connect", function(ee) { |
|
|
var port = ee.ports[0]; |
|
|
var port = ee.ports[0]; |
|
|
con.push(port); |
|
|
con.push(port); |
|
|
|
|
|
|
|
|
port.onmessage = function (e) { //addEventListener doesnt seams to work well
|
|
|
|
|
|
|
|
|
port.onmessage = function (e) { |
|
|
var newCtx = e.data; |
|
|
var newCtx = e.data; |
|
|
|
|
|
|
|
|
if (lastCtx && newCtx !== lastCtx) { |
|
|
if (lastCtx && newCtx !== lastCtx) { |
|
|
con.map(function (eport) { |
|
|
|
|
|
|
|
|
con.forEach(function (eport) { |
|
|
eport.postMessage({type: "newCtx", "newCtx": newCtx, "lastCtx": lastCtx}); |
|
|
eport.postMessage({type: "newCtx", "newCtx": newCtx, "lastCtx": lastCtx}); |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|