Refactored reactive store

This commit is contained in:
Rohan Sircar 2020-12-20 16:30:06 +05:30
parent f721768098
commit 9155fdac96
10 changed files with 17 additions and 17 deletions

View File

@ -10,13 +10,13 @@ import io.odin.syntax._
import nova.monadic_sfx.actors.ActorModule
import nova.monadic_sfx.http.HttpModule
import nova.monadic_sfx.ui.UiModule
import nova.monadic_sfx.util.reactive.Middlewares
import nova.monadic_sfx.util.reactive.store.Middlewares
trait MainModule extends ActorModule with UiModule with HttpModule {
def routerLogger(defaultLogger: Logger[Task], storeLogger: Logger[Task]) =
enclosureRouting[Task](
"nova.monadic_sfx.util.reactive.Middlewares" -> storeLogger,
"nova.monadic_sfx.util.reactive.Store" -> storeLogger
"nova.monadic_sfx.util.reactive.store.Middlewares" -> storeLogger,
"nova.monadic_sfx.util.reactive.store.Store" -> storeLogger
)
.withFallback(defaultLogger)
.withAsync(timeWindow = 1.millis)

View File

@ -8,9 +8,9 @@ import io.circe.generic.semiauto._
import io.odin.Logger
import monix.bio.Task
import nova.monadic_sfx.util.IOUtils
import nova.monadic_sfx.util.reactive.Middlewares
import nova.monadic_sfx.util.reactive.Reducer
import nova.monadic_sfx.util.reactive.Store
import nova.monadic_sfx.util.reactive.store.Middlewares
import nova.monadic_sfx.util.reactive.store.Reducer
import nova.monadic_sfx.util.reactive.store.Store
import scalafx.scene.Parent
object FXRouter {

View File

@ -14,7 +14,7 @@ import nova.monadic_sfx.implicits.FontIcon
import nova.monadic_sfx.implicits.IconLiteral
import nova.monadic_sfx.implicits.JFXListView
import nova.monadic_sfx.implicits._
import nova.monadic_sfx.util.reactive._
import nova.monadic_sfx.util.reactive.store._
import scalafx.Includes._
import scalafx.beans.property.StringProperty
import scalafx.collections.ObservableBuffer

View File

@ -4,9 +4,9 @@ import com.softwaremill.quicklens._
import io.circe.generic.JsonCodec
import io.odin.Logger
import monix.bio.Task
import nova.monadic_sfx.util.reactive.Middlewares.actionLoggerMiddleware
import nova.monadic_sfx.util.reactive.Reducer
import nova.monadic_sfx.util.reactive.Store
import nova.monadic_sfx.util.reactive.store.Middlewares.actionLoggerMiddleware
import nova.monadic_sfx.util.reactive.store.Reducer
import nova.monadic_sfx.util.reactive.store.Store
case class Todo(id: Int, content: String)

View File

@ -10,7 +10,7 @@ import nova.monadic_sfx.implicits.JFXListView
import nova.monadic_sfx.implicits.JFXTextField
import nova.monadic_sfx.implicits.MenuItem
import nova.monadic_sfx.implicits._
import nova.monadic_sfx.util.reactive._
import nova.monadic_sfx.util.reactive.store._
import org.gerweck.scalafx.util._
import scalafx.Includes._
import scalafx.beans.property.ObjectProperty

View File

@ -1,4 +1,4 @@
package nova.monadic_sfx.util.reactive
package nova.monadic_sfx.util.reactive.store
import java.time.LocalDateTime

View File

@ -1,4 +1,4 @@
package nova.monadic_sfx.util.reactive
package nova.monadic_sfx.util.reactive.store
import scala.concurrent.Future

View File

@ -1,4 +1,4 @@
package nova.monadic_sfx.util.reactive
package nova.monadic_sfx.util.reactive.store
import cats.implicits._
import monix.reactive.Observable

View File

@ -1,4 +1,4 @@
package nova.monadic_sfx.util.reactive
package nova.monadic_sfx.util.reactive.store
import java.time.LocalDateTime

View File

@ -1,9 +1,9 @@
package nova.monadic_sfx.util
package nova.monadic_sfx.util.reactive
import monix.reactive.Observable
import monix.reactive.Observer
package object reactive {
package object store {
type MonixProSubject[-I, +O] = Observable[O] with Observer[I]
type Middleware[A, M] = Observable[(A, M)] => Observable[(A, M)]
type Store[A, M] = MonixProSubject[A, (A, M)]