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

@glimmer/reference

Package Overview
Dependencies
Maintainers
15
Versions
288
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@glimmer/reference

Objects used to track values and their dirtiness in Glimmer

  • 0.93.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
183K
increased by19.43%
Maintainers
15
Weekly downloads
 
Created

What is @glimmer/reference?

@glimmer/reference is a package that provides a set of utilities for managing and observing references in the Glimmer VM. It is primarily used in the context of Ember.js and Glimmer.js to handle reactive data and bindings efficiently.

What are @glimmer/reference's main functionalities?

Creating References

This feature allows you to create constant references that hold a static value. The `createConstRef` function is used to create a reference with a given value and label.

const { createConstRef } = require('@glimmer/reference');
const ref = createConstRef('Hello, world!', 'greeting');
console.log(ref.value()); // Output: 'Hello, world!'

Updating References

This feature allows you to create updatable references that can change their value over time. The `createUpdatableRef` function is used to create a reference that can be updated with a new value.

const { createUpdatableRef } = require('@glimmer/reference');
const ref = createUpdatableRef('Initial value');
console.log(ref.value()); // Output: 'Initial value'
ref.update('Updated value');
console.log(ref.value()); // Output: 'Updated value'

Tracking References

This feature allows you to track changes to references and react to those changes. The `track` function is used to execute a callback whenever the value of a reference changes.

const { createConstRef, createUpdatableRef, track } = require('@glimmer/reference');
const constRef = createConstRef('Static value');
const updatableRef = createUpdatableRef('Dynamic value');
track(() => {
  console.log(constRef.value()); // Output: 'Static value'
  console.log(updatableRef.value()); // Output: 'Dynamic value'
});
updatableRef.update('New dynamic value');
track(() => {
  console.log(updatableRef.value()); // Output: 'New dynamic value'
});

Other packages similar to @glimmer/reference

FAQs

Package last updated on 27 Nov 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

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