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

jano.js

v1.0.0

Published

Transforms callback hell into tuneful heaven.

Downloads

4

Readme

jano.js

jano.js transforms callback hell into tuneful heaven. The true reason why programmers started to use this nasty word "hell" is, they have never found a pleasure in callbacks. jano.js allows you to enjoy every single callback nesting. The more, the better!

Why woud I use this?

You love music. Or do you read this text in silence? :O

Now, imagine you are a composer. A famous one. Do you already hear a new song arising from the depths of your heart? Now, write it down. Not on the sheet of paper! In JavaScript. You are a programmer, after all.

"How would I do that?" Man, jano.js is here for you.

Example first

new jano(1, 300).play(function(){
	this.play()
}, function(){
	this.play(function(){
		this.play()
	})
}).start()

Yay, what the h**l is this mess of callbacks? Let's dive into it.

How it works

There is a music notation which describes a melody in a series of a notes. Deeper tones are written in lower positions than higher tones. We read the notation from the left to the right.

In JavaScript, we rotate this notation by 90 degree. We read from the top to the bottom and deeper tone is positioned more to the left than higher tone (well, that depends on indentation only, but think not of your ugly thoughts to indent otherwise). So the example song plays depper tone first and higher tone afterwards. Note, that only 0-parameters play() calls produce the tone. This allows us to define higher tones by nesting play() method. The more nesting, the higher tone. Simple, right?

Now, as a famous composer, you obviously know, that music is not tones only. How do we define a tempo? And what about note durations? They aren't all whole notes, after all.

Options

jano class accepts 2 parameters:

tone_base Int 1

Sets lowest tone you want to use. Accepts integer in range 1-27. We are programmers. We use integers, not some random alphabet like "cdefgab".

default_timeout Int 300

Sets default timespan between two tones in ms. We are programmers, not dirigents to use such innacurate tempo names as "Larghetto" or "Presto" (as we are not Italians, too, man!).

play method accepts 1 parameter, too:

timeout Int 300

If specified, timespan between this tone and next one will be timeoutms. Otherwise, default_timeout will be used to calculate duration.

Turn Up the Music!

In order to fire your melody up, call start() method. Thats it. Enjoy and share!

Showcase

Have you composed a cripsy melody to share with the world? Send a Pull Request adding link to your melody here in the showcase list!

Contribution

Do you feel like this package needs something to add? Feel free to post a Pull Request!

License

Copyright (c) 2016 Jakub Senko.

Released under the MIT License.