npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ractive-ractive

v1.1.1

Published

Ractive adaptor for Ractive objects

Downloads

97

Readme

ractive-ractive

Experimental ractive adaptor for ractive objects. This makes it possible to use template-less Ractive objects as models.

Find more Ractive.js plugins at docs.ractivejs.org/latest/plugins

Status

Note for v0.x users:

v1.0.0 changes the behavior of doing require('ractive-ractive') (eg, in Browserify). See the changelog for upgrade instructions.

Example

Ractive.defaults.adapt.push('Ractive');

parent = new Ractive();
user   = new Ractive();

parent.set('user', user);

Changes in children are propagated to the parent:

user.set('name', 'Jake');
parent.get('user.name')   //=> "Jake"

Changes in the parent are propagated to the children:

parent.set('user.name', 'Matt');
user.get('name')   //=> "Matt"

Features

Everything you'd expect to work will work.

  • bi-directional propagation
  • observers
  • templates
  • computed properties

However, these things are not supported, but may be in the future:

  • circular dependencies (an error will be thrown)
  • events (see ractive#1249)

Wrap events

It will trigger a few events:

  • wrap - called when the instance is set as an attribute of another instance
  • unwrap - called when the instance has been unset from its parent
  • wrapchild - called when the instance gets an Ractive attribute set
  • unwrapchild - called when the instance gets an Ractive attribute unset

To illustrate:

parent = new Ractive();
child  = new Ractive();

parent.set('x', child);
// triggers `wrap(parent, 'x')` on child
// triggers `wrapchild(child, 'x')` on parent

parent.set('x', undefined);
// triggers `unwrap(parent, 'x')` on child
// triggers `unwrapchild(child, 'x')` on parent

Usage

ractive-ractive is available via npm.

$ npm install --save ractive-ractive

npm version

In CommonJS:

Ractive.adaptors.Ractive = require('ractive-ractive');
Ractive.defaults.adapt = ['Ractive'];

Without module loaders, the adaptor is available as "Ractive" under Ractive.adaptors.Ractive.

Credits

Hat tip to the original Ractive adaptor from @Rich-Harris. (src)

Thanks

ractive-ractive © 2014+, Rico Sta. Cruz. Released under the MIT License. Authored and maintained by Rico Sta. Cruz with help from contributors (list).

ricostacruz.com  ·  GitHub @rstacruz  ·  Twitter @rstacruz