Skip to content

Commit

Permalink
hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
scobru committed Oct 10, 2024
1 parent c530d80 commit 4e506bc
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 235 deletions.
3 changes: 0 additions & 3 deletions packages/svelte/gun.config.json

This file was deleted.

94 changes: 0 additions & 94 deletions packages/svelte/src/lib/hooks/useGun.ts

This file was deleted.

119 changes: 0 additions & 119 deletions packages/svelte/src/lib/hooks/useRelay.ts

This file was deleted.

21 changes: 2 additions & 19 deletions packages/svelte/src/lib/stores.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,10 @@
import type { IGunInstance } from "gun";
import { writable, type Writable } from "svelte/store";
import { browser } from '$app/environment';
import Gun from 'gun';
import "gun-eth";
import { useGun } from "./hooks/useGun";
import { useGun } from "./gun";

export const currentUser = writable(null);
export const gun = writable(null) as unknown as Writable<IGunInstance<any>>;

let gunInstance = useGun();
gun.set(useGun());

gun.set(gunInstance);

Gun.on('opt', function (ctx) {
if (ctx.once) {
return
}
ctx.on('out', function (msg) {
var to = this.to
// Adds headers for put
msg.headers = {
token: 'test'
}
to.next(msg) // pass to next middleware
})
})

0 comments on commit 4e506bc

Please sign in to comment.