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

@ecomfe/san-devhook

v0.1.18

Published

Hook for san-devtool.

Downloads

29

Readme

San-DevHook

Hook for San. Append a __san_devtool__ namespace on global context contains components and stores raw data.

Usage

Automatically

  • Add autohook in page URL: http://xxx/?autohook
  • Add autohook in script URL: <script src="http://xxx/hook.js?autohook"></script>

Programmatically

import {initHook} from '@ecomfe/san-devhook';

const config = {
    hookOnly: true,                                 // Do not send any message to content script (Only for extension).
    subKey: 'treeData',                             // Key for the array of sub component tree.
    prefixForBindingData: 'my',                     // Auto bing data and props using specified prefix.
    conditions: [{
        listeners: ['onAfterGenerateData', e => { }],
        event: eventName,
        target: targetDOM                           // All listeners will be disabled (do not execute) until the event
    }],                                             // binding on the target is triggered.
    onGenerateData: (
        message, cnode, parentId, component) => {}, // Append customized data for generating component tree.
    onAfterGenerateData: (message, cnode, parentId, component) => {},
    onBeforeListenSan: () => {},                      // Do something before a San event.
    onSanMessage: (
        message, cnode, parentId, component) => {}, // Procedure when a San event triggering.
    onAfterListenSan: () => {},                       // Procedure after a San event.
    onBeforeListenStore: () => {},                    // Procedure before a san-store event.
    onStoreMessage: () => {},                       // Procedure when a san-store event triggering.
    onAfterListenStore: () => {},                     // Procedure after a san-store event.
    onRetrieveData: tree => {},                     // Retrieve root CNode after calling retrieveData().
    onRootReady: (cnode, component) => {}           // Emit when root component is ready.
    onSan: sender => {}                             // Emit when San is initialized.
};

// The last argument called *config* is the configuration of san-devhook in all callbacks.

initHook(config);

In Console

__san_devtool__ namespace

  • san: A San object including version info, Component class etc.
  • _config: User configuration. Please see the section above.
  • initHook: initHook function. Please see the section above.
  • data: Whole component tree.
  • history: San event history.
  • store: Mutation records and stores for san-store.
  • routes: Route info for san-router.
  • getData(): Return data synchronously.
  • retrieveData(): Emit onRetrieveData.
  • showTree(): Display the component tree.

Objects binding on DOM

  • __SAN_COMPONENT__: The component instance of current DOM object.
  • __SAN_DATA__: The component data.
  • __SAN_PROPS__: The component props.
  • __SAN_CNODE__: A CNode instance of component acts as a serializable object.
  • __SAN_PATH__: Ancestor component ID list.
  • showTree(): Display the component tree under current DOM object.

More instructions refer to docs folder.

Tests

Run extension test

$ npm run chrome

And open a page using San.

Run browser test

$ npm run browser