Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@etherealengine/hyperflux

Package Overview
Dependencies
Maintainers
4
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@etherealengine/hyperflux

State Management for Ethereal Engine

  • 1.2.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
8
increased by700%
Maintainers
4
Weekly downloads
 
Created
Source

HyperFlux

HyperFlux brings together various state management strategies in Ethereal Engine, in a way that makes it easy to introspect and test.

In Ethereal Engine, we define 3 different stores

The ENGINE store is, meaning actions are dispatched directly on the incoming queue, and run on the Engine timer.

createHyperStore({
  name: 'ENGINE',
  getDispatchId: () => 'engine',
  getDispatchTime: () => Engine.instance.elapsedTime
})
// IncomingActionSystem
import { applyIncomingActions } from '@etherealengine/hyperflux'
export default async function IncomingActionSystem(world) {
  return () => {
    applyIncomingActions(Engine.instance.store)
  }
}

In any case, the appropriate store must be provided when dispatching an action:

dispatchAction( WorldNetworkAction.spawnAvatar({ parameters }))

Likewise when adding or removing receptors:

addActionReceptor((a) =>
  matches(a).when(WorldNetworkAction.spawnObject.matches, (a) => recepted.push(a))
)

State objects can also be defined and retrieved from a store:

const PeerState = defineState('peers', () => {
    return [] // initial state
})

// get state
const peerState = getState(Engine.instance.store, PeerState)

All incoming, outoing, and historical actions accessible on the store.actions object.

FAQs

Package last updated on 31 Mar 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc