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

@openmind/zero

v0.1.7

Published

The Openmind Zero framework project

Downloads

1,198

Readme

Project Zero

Contribute

Make sure you're using nvm as node environment. Otherwise check it on nvm Make sure you have installed brew. Otherwise check it on Homebrew

git clone ssh://[email protected]:7999/oc/zero.git
cd zero
nvm use
npm install -g npm
brew install yarn --without-node
yarn global add gulp-cli yo
yarn install
gulp

Work with Zero

Creating component

In your project go to 'javascripts' folder and create components folder.

Create a new file as follow:

my_new_compoent.js

Copy this code in order to quickly start using it

import {Logger, Zero, Components, Utils} from 'Zero'

const Log = new Logger('MyComponentName');

export default class MyComponentName extends Components {

  get Messages() {
    return {
      "Message:To:Handle": this.onMessageReceived
    }
  }

  constructor(element) {
    super(element)
  }

  onMessageReceived() {
    // TODO: do something awesome
  }

}

(new) Zero can work with previous Boilerplate

Import Zero via bower or via npm (recommended) Make sure you are importing latest available version (see tags)

// bower.json
"dependencies": {
    "om-zero": "ssh://[email protected]:7999/oc/zero.git#{version}"
}
// npm via package.json
"dependencies": {
    "@openmind/zero": "#{version}"
}
Import zero-bridge.umd.js located into build/ folder.
NOTE: make sure the script is imported after app.js and before App.init().
<html>
    <head>
        ...
    </head>
    <body>
        ...
        <script src="path/to/{libs}.js"></script>
        <script src="path/to/app.js"></script>
        <script src="path/to/zero-bridge.umd.js"></script>
        <script>
            App.init()
        </script>
    </body>
</html>
Now you can start writing Components in Zero and they can work with all other components within boilerplate
// new_component_file.js
// Header of file as usual in boilerplate
(function($, App, Components, Pages, Utils) {
    //-- See Zero documentation if any doubts --
    App.ZeroComponent('MyNewComponent', {
      Messages: function(){
        return {
          'mynewcomponent:something': this.somethingHappened.bind(this)
        };
      },

      init: function(element) {
        this.element.find(".selector").on("click", function(e){
          e.preventDefault();
          //-- Fire Message event in order to be captured from any other component
          App.Zero.Broadcast.cast("mynewcomponent:something-else", {code: "001"});
        });
      },

      somethingHappened: function(e, msg) {
        //-- Message from other component has been captured
        alert("Oh wow, something happened!" + msg.code === "002" );
        this.element.addClass("happened");
      }
    });
})(jQuery, App, App.Components, App.Pages, App.Utils);

// already_existing_component.js
(function($, App, Components, Pages, Utils) {
  Components.create('MyOlderComponent', {
    bindEvents: function() {
      Components.on("mynewcomponent:something-else", function(e, msg) {
        alert("A new component say:" + msg.code);
      });

      $(".older-selector").on("click", function(e) {
        e.preventDefault();

        // Send message to all other components
        Components.trigger("mynewcomponent:something", {code: "002"});
      })

    },
    init: function() {
      this.bindEvents();
    }
  });
})(jQuery, App, App.Components, App.Pages, App.Utils);

Enjoy ;)