Skip to content

Commit

Permalink
Create NOTES.md
Browse files Browse the repository at this point in the history
  • Loading branch information
lilactown authored Dec 26, 2024
1 parent afa6491 commit d97ef13
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions NOTES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Ideas

## Remote sources/signals

Have the ability to have a shared graph between client/server.

```clojure
(ns server
(:require
[town.lilac.flex.core :as flex]
[town.lilac.flex.remote.server :as flex.server]))


(def *state (flex/source {:foo "bar"}))

(def *foo (flex/signal (:foo @*state)))

(def server
(flex.server/serve
;; available sources/signals
{:state *state
:foo *foo}
;; config
{:http/port 8888
:protocol :ws/http}))
```

```clojure
(ns client
(:require
[town.lilac.flex.core :as flex]
[town.lilac.flex.remote.client :as flex.client]))

(def client
(flex.client/client
{:port 8888
:protocol :ws/http}))

;; signal to represent remote server state
(def *state (flex.client/signal client :state))

;; can listen to/deref it like a normal signal
(def *fooA (flex/signal (:foo @*state)))

;; or listen to the remote server signal
(def *fooB (flex.client/signal client :foo))
```

0 comments on commit d97ef13

Please sign in to comment.