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 🙏

© 2025 – Pkg Stats / Ryan Hefner

clientnode

v3.0.1336

Published

upgrade to object orientated rock solid plugins

Readme

Project status

npm npm downloads

build build push package

check types lint test

code coverage

deploy documentation website documentation website

Try out

Use case

Simple generic (web and node compatible) utility library.

Features

Installation

Classical dom injection

You can simply download the compiled version as zip file here and inject it after needed dependencies:

<script
    src="https://code.jquery.com/jquery-3.6.0.min.js"
    integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4="
    crossorigin="anonymous"
></script>
<!--Inject downloaded file:
<script src="index.js"></script>
-->
<!--Or integrate via cdn:-->
<script
    src="https://torben.website/clientnode/data/distributionBundle/index.js"
></script>

The compiled bundle supports AMD, commonjs, commonjs2 and variable injection into given context (UMD) as export format: You can use a module bundler if you want.

Package managed and module bundled

If you are using npm as package manager you can simply add this tool to your package.json as dependency:

...
"dependencies": {
    ...
    "clientnode": "latest",
    ...
},
...

After updating your packages you can simply depend on this script and let a module bundler do the hard stuff or access it via an exported variable name in given context.

...
import Tools from 'clientnode'
clas Plugin extends Tools...
Tools({logging: true}).log('test') // shows "test" in console
// or
import {$} from 'clientnode'
$.Tools().isEquivalentDom('<div>', '<script>') // false
// or
{makeArray} = require('clientnode').default
makeArray(2) // [2]
// or
$ = require('clientnode').$
$.Tools().isEquivalentDom('<div>', '<script>') // false
...

Plugin pattern

Use as extension for object orientated, node and browser compatible (optionally jQuery) plugin using inheritance and dom node as return value reference. This plugin pattern gives their instance back if no dom node is provided. Direct initializing the plugin without providing a dom node is also provided. Note: if you want to use it as jQuery (or another or even custom) plugin you have to provide "$" globally before loading this module.

'use strict'
import {$} from 'clientnode'
/**
 * This plugin holds all needed methods to extend input fields to select
 * numbers very smart.
 * @extends clientnode:Tools
 * @property static:_name - Defines this class name to allow retrieving them
 * after name mangling.
 * @property _options - Options extended by the options given to the
 * initializer method.
 */
export default class Example extends $.Tools.class {
    static _name = 'Example';
    /* eslint-disable jsdoc/require-description-complete-sentence */
    /**
     * Initializes the plugin. Later needed dom nodes are grabbed.
     * @param options - An options object.
     * @returns Returns $'s extended current dom node.
     */
    initialize(options = {}) {
    /* eslint-enable jsdoc/require-description-complete-sentence */
        this._options = {/*Default options here*/}
        super.initialize(options)
        return this.$domNode
    }
}
$.fn.Example = function() {
    return $.Tools().controller(Example, arguments, this)
}

Initialisation with given dom node and without:

const $domNode = $('#domNode').Example({firstOption: 'value'});
const exampleInstance = $.Example({firstOption: 'value'});

Function call from previous generated instance via dom node or instance reference:

const returnValue = $('#domNode').Example('method', 'anArgument')
const returnValue = $('#domNode').Example().method('anArgument')
const exampleInstance = $.Example({firstOption: 'value'})
const returnValue = exampleInstance.method('anArgument')