Skip to content

Commit

Permalink
👷 Provide dual CJS/ESM build
Browse files Browse the repository at this point in the history
  • Loading branch information
iMrDJAi committed Jun 1, 2022
1 parent 20e6323 commit 4d3ac7c
Show file tree
Hide file tree
Showing 6 changed files with 2,334 additions and 6 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ jobs:
with:
node-version: '12.x'
registry-url: 'https://registry.npmjs.org'
- name: Install deps
run: npm i
- name: Build...
run: npm run build
- name: Publish!
run: npm publish
env:
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
node_modules/
dist/
.DS_Store
1 change: 1 addition & 0 deletions dist/useSync.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions dist/useSync.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import{useReducer as f,useEffect as l,useRef as p}from"react";var n={},a=(e,c)=>{let[,o]=f(t=>!t,!1),s=p(c),u=(...t)=>{let[r]=t;t.length&&(s.current=r),o()};return l(()=>(n[e]||(n[e]=[]),n[e].push(u),()=>{let t=n[e].findIndex(r=>r===u);n[e].splice(t,1),n[e].length===0&&delete n[e]}),[e]),s.current},i=(...e)=>{let[c,o]=e;if(!!n[c])for(let s of n[c])setTimeout(()=>e.length<2?s():s(o),0)},x={};var d=a;export{d as default,x as storage,i as sync,a as useSync};
Loading

0 comments on commit 4d3ac7c

Please sign in to comment.