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

ctrl8

v0.0.17

Published

Ctrl8

Downloads

7

Readme

Ctrl8

Installation

npm install ctrl8 --save

Usage

Mainly used for creating custom component.

Inheritance

      function Toy(init) {
			Toy.baseConstructor.call(this,init);
	  }
	  Ctrl8.ExtendsTo(Toy)

Define custom properties

	  
	function Specification(init){
		Specification.baseConstructor.call(this,init);
		this.Prop("BaseHeight",1);
		this.Prop("Width",1);
		this.Prop("Length",1);
		this.Prop("WheelCount",2);
		this.CalcProp("Volume",function(){
			return this.Width*this.BaseHeight*this.Length;
		})
	}
	
	Ctrl8.ExtendsTo(Specification)

	function Toy(init) {
		Toy.baseConstructor.call(this,init);
		this.Prop("Name","My Default Name");
		this.CalcProp("Specs",function(name,store){
			return new Specification(store[name]||(store[name]={}))
		},null,1); //Configurable
	}
	Ctrl8.ExtendsTo(CustomComponent1)

	function ControlUnit(init){
		ControlUnit.baseConstructor.call(this,init);
		this.Prop("Memory",3000000000); //3GBs
		this.Prop("Speed",45000000000); //4.5GHz;
	}

	Ctrl8.ExtendsTo(ControlUnit)

	function ASpec(init){
		ASpec.baseConstructor.CalcProp(this,init);
		this.Prop("RequiredPower",1.3) // Default 1.3 volts;
		this.Prop("WireCount",3) //Default WireCount: 3
		this.CalcProp("CPU",function(name,store){
			return new ControlUnit(store[name]||(store[name]={}))
		});
	}

	Specification.ExtendsTo(ASpec)


	function Robot(init){
		Robot.baseConstructor.call(this.init);
		this.Prop("SerialNumber","0000-0000-0000");
		this.CalcProp("Specs",function(name,store){
			return new ASpec(store[name]||(store[name]={}))
		},null,1) //Override Specs
	}

	Toy.ExtendsTo(Robot);


	var Comp1 = new Toy({
		"Name":"Toy1", // Set initial name
		"Specs": {
			"BaseHeight": 2,
			"Width":12,
			"Length":20,
			"WheelCount":4
		}
	})

	console.log(Comp1.Name);
	console.log("Toy Length: " , Comp1.Specs.Length);
	console.log("Volume: ", Comp1.Specs.Volume);

	var Android1 = new Robot({
		"Name":"Made Of Steel",
		"Specs": {
			"BaseHeight": 10,
			"Width":2,
			"Length":2,
			"WheelCount":8,
			"RequiredPower":9,
			"WireCount":125,
			"CPU":{
				"Memory":8000000000 //8GBs
			}
		}
	})

	console.log("Robot name: ",Android1.Name);
	console.log("Brain Speed: ",Android1.Specs.CPU.Speed);
	Android1.Specs.CPU.Speed+=2000; //Add more speed;

	console.log("New Brain Speed: ",Android1.Specs.CPU.Speed);