🚀 Socket Launch Week Day 4:Socket MCP Adds Org Alerts, Threat Feed Review, and Package Inspection.Learn more
Sign In

@beaker73/live-update

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@beaker73/live-update

Xrm LiveUpdate tries to simplify 'scripting' for DataVerse Model Driven apps by eliminating all the plumping (getting attributes, attaching and removing event handlers, hiding or showing fields) so we are mostly left with only business logic.

latest
Source
npmnpm
Version
0.1.0
Version published
Weekly downloads
3
-78.57%
Maintainers
1
Weekly downloads
 
Created
Source

Xrm LiveUpdate

Xrm LiveUpdate tries to simplify 'scripting' for DataVerse Model Driven apps by eliminating all the plumping (getting attributes, attaching and removing event handlers, hiding or showing fields) so we are mostly left with only business logic.

It was inspired by react, implementing the business logic as render functions and by home assistant templates and how de detect dependencies on states.

Internal Implementation Abstractions

Memory

The root level abstraction is called memory. During every render you can tell it to 'remember' something. As long as you remember or recall this item on every render it is not forgotten. But as soon as you do not activly recall something it will be forgotten at the end of the render fase. You can provided a callback to be called during forgetting, but not block the forgetting.

Memory is per render function, thus multiple render functions cannot influence each other.

Normally you would not directly use the remember/recall functions yourself, but use the hooks that use this abstraction to be implemented.

useEffect

The first abstraction that is generally used by developers is useEffect. Most other abstractions are based on this one.

useEffect activily remembers the setup and cleanup functions as long as it is called. On first call it executes the provided setup function. On next renders it recognizes the key and does not call the setup again. Until useEffect is not called anymore during a render, and thus it will be forgotten. The forget callback will ensure the cleanup is then called.

This effectly ensure that setup is only called once as long as useCallback is called during every render. And cleanup is called exactly once just after useCallback was not called anymore during render.

useId

use Id returns an id that should be unique, but still returns that same id on every render call.

It works by hasing the stack trace from the start of the render function. Effectivly generate a unique id that is always the same for the same line, but different when you call this method again a second time from a different location.

This Id is often used as a unique memory key by other hooks.

warning: The implementation is dependend on the stacktrace generated by the beaker73/async-context package. But then again, this whole library effectivly is.

FAQs

Package last updated on 19 Mar 2024

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