Skip to content

Instantly share code, notes, and snippets.

View barakcodes's full-sized avatar

barakcodes barakcodes

View GitHub Profile
@barakcodes
barakcodes / useBroadcastChannel.ts
Created February 5, 2024 12:12 — forked from KristofferEriksson/useBroadcastChannel.ts
A React hook that allows you to send and receive messages between browser tabs or windows
import { useCallback, useEffect, useRef, useState } from "react";
interface UseBroadcastChannelOptions {
name: string;
onMessage?: (event: MessageEvent) => void;
onMessageError?: (event: MessageEvent) => void;
}
interface UseBroadcastChannelReturn<D, P> {
isSupported: boolean;
@barakcodes
barakcodes / .eslintrc.json
Created March 28, 2018 22:58 — forked from leny/.eslintrc.json
ESLint config file for node.js + ES6 projects.
{
"env": {
"node": true,
"es6": true
},
"ecmaFeatures": {
"arrowFunctions": true,
"blockBindings": true,
"classes": true,
"defaultParameters": true,