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

fluids

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fluids - npm Package Compare versions

Comparing version 0.1.3 to 0.1.4

2

package.json
{
"name": "fluids",
"version": "0.1.3",
"version": "0.1.4",
"description": "Glue layer for reactivity",

@@ -5,0 +5,0 @@ "main": "src/index.js",

@@ -9,2 +9,4 @@ # fluids

 
## API

@@ -35,2 +37,4 @@

 
## Types

@@ -67,5 +71,7 @@

 
## `FluidConfig` example
This example adds observability to a ref object (like in React: `{ value }`).
This example adds observability to a ref object, like what `React.useRef` returns.

@@ -77,4 +83,4 @@ Any object can conform to the `FluidConfig` interface **without needing to change its public API.**

/** Create a `{ value }` object that can be observed */
function createRef(value) {
/** Create a ref object that can be observed */
function createRef(current) {
const ref = {}

@@ -88,13 +94,13 @@

// Change tracking
const get = () => value
Object.defineProperty(ref, 'value', {
const get = () => current
Object.defineProperty(ref, 'current', {
enumerable: true,
get,
set: newValue => {
if (value !== newValue) {
value = newValue
if (current !== newValue) {
current = newValue
emit({
type: 'change',
parent: ref,
value,
value: newValue,
})

@@ -116,2 +122,4 @@ }

 
## `FluidObserver` example

@@ -133,5 +141,5 @@

ref.value++
ref.current++
stop()
ref.value++
ref.current++
```
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