git.iko.soy/rowtype-yoga/purescript-y-indexeddb
on main help sign in
Add y-indexeddb
commit0ee3130863a6b3ac0bfa8c85648b68137f012ef6 authorsigma-andex <77549848+sigma-andex@users.noreply.github.com> dateMon 20 Mar 2023, 19:39 (4 years ago) parent707afac
9 files changed+92
unifiedsplit
.gitignore+10 LICENSE+16 README.md+2 package.json+12 packages.dhall+18 spago.dhall+5 src/YIndexedDb/YIndexedDb.js+4 src/YIndexedDb/YIndexedDb.purs+14 test/Main.purs+11
.gitignorenew file+10
@@ -0,0 +1,10 @@
1+/bower_components/
2+/node_modules/
3+/.pulp-cache/
4+/output/
5+/generated-docs/
6+/.psc-package/
7+/.psc*
8+/.purs*
9+/.psa*
10+/.spago
LICENSEnew file+16
@@ -0,0 +1,16 @@
1+MIT No Attribution
2+
3+Copyright 2021 Betalyra Sociedade Unipessoal Lda
4+
5+Permission is hereby granted, free of charge, to any person obtaining a copy of this
6+software and associated documentation files (the "Software"), to deal in the Software
7+without restriction, including without limitation the rights to use, copy, modify,
8+merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
9+permit persons to whom the Software is furnished to do so.
10+
11+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
12+INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
13+PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
14+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
15+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
16+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
README.md+2
@@ -1 +1,3 @@
11# purescript-y-indexeddb
2+
3+Purescript FFI bindings for [y-indexeddb](https://github.com/yjs/y-indexeddb).
package.jsonnew file+12
@@ -0,0 +1,12 @@
1+{
2+ "name": "purescript-y-indexeddb",
3+ "version": "1.0.0",
4+ "description": "",
5+ "main": "index.js",
6+ "scripts": {
7+ "test": "echo \"Error: no test specified\" && exit 1"
8+ },
9+ "keywords": [],
10+ "author": "",
11+ "license": "ISC"
12+}
packages.dhallnew file+18
@@ -0,0 +1,18 @@
1+let upstream =
2+ https://github.com/purescript/package-sets/releases/download/psc-0.15.7-20230320/packages.dhall
3+ sha256:6f2a4b50b793f304d3a64fd25d631de990de280981c73b0683a090e4fa499f0d
4+
5+in upstream
6+ with yjs =
7+ { dependencies =
8+ [ "console"
9+ , "effect"
10+ , "foreign"
11+ , "functions"
12+ , "newtype"
13+ , "prelude"
14+ , "web-dom"
15+ ]
16+ , repo = "https://github.com/rowtype-yoga/purescript-yjs.git"
17+ , version = "fc233e7"
18+ }
spago.dhallnew file+5
@@ -0,0 +1,5 @@
1+{ name = "y-indexeddb"
2+, dependencies = [ "console", "effect", "prelude", "yjs" ]
3+, packages = ./packages.dhall
4+, sources = [ "src/**/*.purs", "test/**/*.purs" ]
5+}
src/YIndexedDb/YIndexedDb.jsnew file+4
@@ -0,0 +1,4 @@
1+import { IndexeddbPersistence } from "y-indexeddb";
2+
3+export const indexedDbPersistenceImpl = (name, doc) =>
4+ new IndexeddbPersistence(name, doc);
src/YIndexedDb/YIndexedDb.pursnew file+14
@@ -0,0 +1,14 @@
1+module YIndexedDb.YIndexedDb
2+ ( indexedDbPersistence
3+ ) where
4+
5+import Prelude
6+
7+import Effect (Effect)
8+import Effect.Uncurried (EffectFn2, runEffectFn2)
9+import Yjs.Yjs as Yjs
10+
11+foreign import indexedDbPersistenceImpl :: EffectFn2 String Yjs.YDoc Unit
12+
13+indexedDbPersistence ∷ String → Yjs.YDoc → Effect Unit
14+indexedDbPersistence = runEffectFn2 indexedDbPersistenceImpl
test/Main.pursnew file+11
@@ -0,0 +1,11 @@
1+module Test.Main where
2+
3+import Prelude
4+
5+import Effect (Effect)
6+import Effect.Class.Console (log)
7+
8+main :: Effect Unit
9+main = do
10+ log "🍝"
11+ log "You should add some tests."