Skip to content

Instantly share code, notes, and snippets.

View sechel's full-sized avatar
😀
Coding

Stefan Sechelmann sechel

😀
Coding
View GitHub Profile
@sechel
sechel / @ BroadcastChannel Polyfill.md
Created September 13, 2018 15:47
BroadcastChannel Polyfill

BroadcastChannel Polyfill

BroadcastChannel is a new communication API proposed in the HTML Standard but not yet widely implemented. It allows messages to be sent to all other BroadcastChannel instances sharing the same channel name within the same browsing context and origin.

var bc = new BroadcastChannel('name');

bc.postMessage(payload);
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/qunit/2.4.1/qunit.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/dexie/3.0.0-alpha.1/dexie.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/qunit/2.4.1/qunit.js"></script>
<title>IndexedDB, WebCrypto, and Primary Keys</title>

Keybase proof

I hereby claim:

  • I am sechel on github.
  • I am sechel (https://keybase.io/sechel) on keybase.
  • I have a public key ASDq8oFsMc8aZYia3gEDsBzgFIfB199PNbq_GMwCV28B6go

To claim this, I am signing this object: