Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
isocroft authored Oct 11, 2017
1 parent a22c0a5 commit b4612ea
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ This is a wrapper script and libarary which makes use of the JS polyfill for _Se
params:{
id:"id"
},
options:{loggingEnabled:true, interval:4500}
options:{loggingEnabled:true, interval:4500,crossdomain:true}
});
// open a connection with relevant callbacks
beam.open(function onopenCalback(e){ }, function onerrorCalback(e){ }, function onmessageCalback(e){ });
beam.start(function onopenCalback(e){ }, function onerrorCalback(e){ }, function onmessageCalback(e){ });
// register an event [update]
beam.on("update", function(e){ });
// register another event [noupdate]
Expand All @@ -34,7 +34,7 @@ This is a wrapper script and libarary which makes use of the JS polyfill for _Se
// unregister an event [update]
beam.off("update");
// close all the connection(s)
beam.close(function(e){ });
beam.stop(function(e){ });
</script>
</body>
</html>
Expand Down Expand Up @@ -80,7 +80,7 @@ The idea here is to loosely couple communications to beamzer-client in an Angula
options:{loggingEnabled:true, interval:4500}
});

CLIENT.open(openCallback, errorCallback, msgCallback);
CLIENT.start(openCallback, errorCallback, msgCallback);

started = true;
},
Expand All @@ -99,7 +99,7 @@ The idea here is to loosely couple communications to beamzer-client in an Angula
},
end:function(closeCallback){

CLIENT.close(closeCallback);
CLIENT.stop(closeCallback);
},
isStarted:function(){

Expand Down Expand Up @@ -370,14 +370,19 @@ The idea here is to loosely couple communications to beamzer-client in an Angula

worker.addEventListener("message", (event) => {
let data = event.data;
if(data.streamClosed){
setTimeout(function() => {
worker.terminate();
},0);
return;
}
console.log(JSON.stringify({data}));
}, false);

worker.postMessage({start:true});

setTimeout(() => {
worker.postMessage({stop:true});
worker.terminate();
}, 8900);

// push-notifs.js file
Expand Down Expand Up @@ -408,8 +413,10 @@ The idea here is to loosely couple communications to beamzer-client in an Angula

if(event.data.stop === true){
if(beam !== null){
beam.close();
beam = null; // reclaim memory
beam.close((e) => {
globale.postMessage({streamClosed:true});
beam = null; // reclaim memory
});
}
}
}, false);
Expand Down

0 comments on commit b4612ea

Please sign in to comment.