New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

reftype

Package Overview
Dependencies
Maintainers
0
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

reftype

A simple reactivity library previously included in `deleight`

latest
Source
npmnpm
Version
1.0.2
Version published
Maintainers
0
Created
Source

Reftype

Reftype was the 10th library added to deleight which has now been abstracted into class-action, action-object and element-action. I think this library has been superceded by element-action; therefore it has been removed from the core project. This library is retained here because it is still useful on its own and some people may even prefer it.

Reftype aims to relieve the burden on the JavaScript programmer to know about the markup layout and structure in a large web application. Without Reftype, we manipulate all aspects of the DOM explicitly with Javascript. We may get some mileage from Actribute but the module is more abstract.

Reftype provides an alternative pattern quite similar to how Vue.JS and Angular operate. It lets you declaratively describe DOM operations using attribute directives. The major difference with Reftype is that it is more transparent, explicit and composable. It aligns with the policy of Deleight to use straight HTML, CSS and JavaScript. It is deliberately designed to be fast, lightweight and memory-efficient.

<main>
    <p t> mercury +&+ venus </p>
    <p t> mercury + or +venus</p>
    <p t>mercury + before + venus</p>
    <section t>earth</section>
    <article t class-a="color1| |color2">mars</article>
</main>
import { RefType } from 'reftype'

const refs = {
    mercury: 'Planet mercury',
    venus: 'The second planet',
    earth: 'Our planet!',
    mars: 'Nearest planetary neighbor',
    color1: 'red',
    color2: 'green'
};

const reftype = new RefType(refs, { sep: { multivalue: '+' } });
reftype.add(document.querySelector('main'));
reftype.react();                     // will apply all reactions
reftype.set({ color1: 'blue' });     // will apply specific reaction...

Keywords

HTML

FAQs

Package last updated on 06 Aug 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