Skip to content

Instantly share code, notes, and snippets.

Avatar
🦁

Lennart Grahl lgrahl

🦁
View GitHub Profile
@lgrahl
lgrahl / main.js
Last active Jul 31, 2018
Cancellable Promises
View main.js
function sleep(timeout) {
return new Promise((resolve) => {
setTimeout(() => {
console.log('timeout!');
resolve();
}, timeout);
});
}
class Future extends Promise {
@lgrahl
lgrahl / future.js
Last active Jul 26, 2018
asyncio-like Future for JavaScript
View future.js
/**
* A future similar to Python's asyncio.Future. Allows to resolve or reject
* outside of the executor.
*/
class Future extends Promise {
constructor(executor) {
let resolve, reject;
super((resolve_, reject_) => {
resolve = resolve_;
reject = reject_;
View saltyrtc-call-flow.md

Peer := Initiator OR Responder

High-Level Call Flow

sc = new SaltyRTC(initiator-permanent-public-key, responder-permanent-private-key=None, token-secret-key=None)
pc = new RTCPeerConnection()
sc.connect()
if initiator:
    offer-sdp = await pc.createOffer()
View keybase.md

Keybase proof

I hereby claim:

  • I am lgrahl on github.
  • I am lgrahl (https://keybase.io/lgrahl) on keybase.
  • I have a public key whose fingerprint is 3FDB 1486 8A2B 36D6 38F3 C495 F98F BED1 0482 ABA6

To claim this, I am signing this object: