Skip to content

Commit

Permalink
Version 0.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
drozdzynski committed May 6, 2024
1 parent 3e5ef05 commit 616a0db
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
20 changes: 18 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Add **storex** to deps in `mix.exs`:

```elixir
defp deps do
[{:storex, "~> 0.3.0"}]
[{:storex, "~> 0.4.0"}]
end
```

Expand Down Expand Up @@ -137,7 +137,7 @@ Storex.mutate(key, store, "increase", [])
Storex.mutate(key, store, "set", [10])
```

### Subscribe to store state changes
### Subscribe to store changes

You can subscribe to store state changes in javascript with function subscribe:

Expand All @@ -147,6 +147,22 @@ store.subscribe((state) => {
})
```

You can also subscribe to events after store is created:

```javascript
store.onConnected(() => {
console.log('connected')
})

store.onError((error) => {
console.log('error', error)
})

store.onDisconnected((closeEvent) => {
console.log('disconnected', closeEvent)
})
```

## Configuration

### Session id generation library
Expand Down
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
defmodule Storex.MixProject do
use Mix.Project

@version "0.3.0"
@version "0.4.0"

def project do
[
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "storex",
"version": "0.3.0",
"version": "0.4.0",
"main": "priv/static/storex.js",
"types": "priv/static/storex.d.ts",
"author": "NERDSLABS <[email protected]>",
Expand Down

0 comments on commit 616a0db

Please sign in to comment.