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

zombrex

v1.1.1

Published

small footprint controller framework

Downloads

10

Readme

zombrex icon

Zombrex, is a controversial framework that greatly slows the process of frontend zombification.

Note:

Not production ready

preload

Preloads data from GET and POST requests. This happens before the application starts to render or store anything.

zombrex.preload([{
    name: 'DATA',
    url: '/app',
}, {
    name: 'ACCS',
    url: '/accs',
    data: { method: 'getUser' }
}]);

preload with components

If you need to access components use a function and return an array.

zombrex.preload(function ({ CONSTANT }) {
    return [{
        name: 'DATA',
        url: `/app/${CONSTANT}`,
    }, {
        name: 'ACCS',
        url: '/accs',
        data: { method: 'getUser' }
    }];
});

render

Render dynamic html before executing the view. Also replaces all linebreaks.

zombrex.render('#calendar', ({ BROWSER, DATA }) => {    
    return `<div>
        <h1>${DATA.title}</h1>
    </div>`; 
});

views

Add views to zombrex. A view is similar to an angular controller. It wraps a part of the dom and allows you to interacte with this part.

<html>
<head></head>
<body>
    <div id="dashboard">
        <p id="board"></p>
    </div>
    
    <!-- scope of calendar view -->
    <div id="calendar">
        <p id="name"></p>
    </div>
</body>
</html>
zombrex.view('#calendar', (scope, { BROWSER, DATA }) => {    
    const name = scope.querySelector('#name');
    
    name.innerText = DATA.name; 
});

constants

Adds constants to the zombrex scope. All types are allowed.

zombrex.constant(Name String, Data Everything);
zombrex.constant('BROWSER', {
    language: (window.navigator.userLanguage || window.navigator.language).substring(0, 2),
    agent: navigator.userAgent,
    timeFormat: new Date().getTimezoneOffset()
});

before

Executes before components are added, or executing the view. Useful for pre compunting things. Has access to constants and build in zombrex components.

zombrex.before(({ BROWSER }) => {
    moment.updateLocale(BROWSER.language, { week: { dow: 1 } });
});

after

Is executed after views. Has access to everything.

zombrex.before(({ DATA, output }) => {
    console.log(DATA);
});

components

Components are similar to angular factorys. The are used to generate reusable components over all views and after.

zombrex.component('output', ({ BROWSER }) => { 
    function browser () {
        return `Language is ${BROWSER.language} and useragent is ${BROWSER.agent}`;
    }
    
    return {
        browser: browser
    };
});    
zombrex.view('#dashboard', (scope, { output }) => {    
    output.browser();
});

lambda

Executes functions after the views are executed and before after is executed.

zombrex.lambda(() => {
    if (localStorage.getItem('dev')) { 
        console.log('dev version is activate');
    }
});

zSHARE

Adds shareable mutable variables over the zombrex scopes.

zombrex.view('#dashboard', (scope, { zSHARE }) => {    
    const board = scope.querySelector('board');
    
    zSHARE.dashboard = function (text) {
        board.innerText = text; 
    };
});
zombrex.view('#calendar', (scope, { zSHARE }) => {     
    zSHARE.dashboard('invoked from calendar view');
});

zombrex cycle

zombrex cyle

Build in Tools

zURLPARAM an object handling url params

zURLPARAM.set('id', '34234324324');
zURLPARAM.get('id');
zURLPARAM.removeAll();

noop a noop function

tabReload a function to reload your tab

Debug

zombrex.view('#dashboard', (scope, { debug }) => {    
    const log = debug('dashboard');
    
    log.log('start'); // outputs dashboard -> start
});

If you want to stop stdout just pass log as string in an array to deactivate.

zombrex.view('#dashboard', (scope, { debug }) => {    
    const log = debug('dashboard');
    
    log.deactivate(['log']); 
});