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

solid-js

Package Overview
Dependencies
Maintainers
1
Versions
463
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

solid-js - npm Package Compare versions

Comparing version 0.3.1 to 0.3.2

5

CHANGELOG.md
# Changelog
## 0.3.2 - 2018-12-30
- Separated useSignal getter/setters for clearer more consistent API
## 0.3.1 - 2018-12-29
- Remove operators from core package since are auxilliary with new API.
- Updated JSX Dom Expressions to use new control flow JSX.
- Updated JSX Dom Expressions to use new control flow JSX and JSX Fragment support.

@@ -7,0 +10,0 @@ ## 0.3.0 - 2018-12-25

@@ -237,3 +237,6 @@ import S$1 from 's-js';

function useSignal(value) { return S$1.data(value); }
function useSignal(value) {
const d = S$1.makeDataNode(value);
return [d.current.bind(d), d.next.bind(d)];
}

@@ -240,0 +243,0 @@ function useEffect(fn, deps, defer) {

4

documentation/api.md

@@ -15,7 +15,7 @@ # API

### `useSignal(initialValue): signal`
### `useSignal(initialValue): [getValueFn, setValueFn]`
Creates a new signal that can be used for reactive tracking.
### `useMemo(prev => <code>, initialValue): signal`
### `useMemo(prev => <code>, initialValue): getValueFn`

@@ -22,0 +22,0 @@ Creates a readonly signal that recalculates it's value whenever the executed codes dependencies update.

@@ -11,6 +11,6 @@ # Signals

function fromInterval(delay) {
var s = useSignal(0);
handle = setInterval(() => s(s() + 1), delay);
const [getCount, setCount] = useSignal(0);
handle = setInterval(() => setCount(getCount() + 1), delay);
useCleanup(() => clearInterval(handle));
return s;
return getCount;
}

@@ -44,3 +44,3 @@ ```

```js
const reducer = (state, action) => {
const reducer = (state, action = {}) => {
switch(action.type) {

@@ -55,4 +55,4 @@ case 'LIST/ADD':

// redux
const dispatch = useSignal(),
getStore = useMemo(state => reducer(state, dispatch()), {list: []});
const [getAction, dispatch] = useSignal(),
getStore = useMemo(state => reducer(state, getAction()), {list: []});

@@ -72,6 +72,6 @@ // subscribe and dispatch

const seconds = useSignal(0);
const div = <div>Number of seconds elapsed: {( seconds() )}</div>
const [getSeconds, setSeconds] = useSignal(0);
const div = <div>Number of seconds elapsed: {( getSeconds() )}</div>
setInterval(() => seconds(seconds() + 1), 1000)
setInterval(() => setSeconds(getSeconds() + 1), 1000)
root(() => document.body.appendChild(div))

@@ -78,0 +78,0 @@ ```

@@ -243,3 +243,6 @@ 'use strict';

function useSignal(value) { return S$1.data(value); }
function useSignal(value) {
const d = S$1.makeDataNode(value);
return [d.current.bind(d), d.next.bind(d)];
}

@@ -246,0 +249,0 @@ function useEffect(fn, deps, defer) {

{
"name": "solid-js",
"description": "A declarative JavaScript library for building user interfaces.",
"version": "0.3.1",
"version": "0.3.2",
"author": "Ryan Carniato",

@@ -6,0 +6,0 @@ "license": "MIT",

@@ -78,7 +78,8 @@ const { root, useState, useSignal, useEffect, reconcile } = require('../lib/solid');

test('Setting state', () => {
test('Setting state from signal', () => {
root(() => {
var data = useSignal('signal'),
var [ getData, setData ] = useSignal('init'),
[ state, setState ] = useState({});
useEffect(() => setState('data', data()));
useEffect(() => setState('data', getData()));
setData('signal')
expect(state.data).toBe('signal');

@@ -85,0 +86,0 @@ });

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