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 🙏

© 2026 – Pkg Stats / Ryan Hefner

faint.js

v0.0.1

Published

Event based Embedded JS framework

Readme

Фронтенд

Использование

<body>
	<script src="faint.js"></script>
	<div id="content">
		Загружаем...
	</div>
</body>
FAINT.init({
	bundle: {
		base_url: 'templates',
	},

	bootstrap: {
		template: 'main',
		data: {hello: 'world'}
	},

	pligins: {

	}
});

Плагины

Шина событий

Отправка

FAINT.ev(['key', 'subkey'], data);
FAINT.ev('key::subkey', data); 	// the same

Подписка

FAINT.ev.on(['key', 'subkey'], function(data) {
   // обработка события key::subkey
});

Семафоры/блокировки

Они всегда именованные.

Использование

FAINT.semaphore(name)
     .then(function(done) {
	// что-то делаем

	done();
     });

Создание:


// при инициализации
FAINT.init({
	semaphore: {
		lock1: 10,
		abc: 1
	}
});

// или так
FAINT.semaphore.create('name', 11);

Ajax

Умеет блокировки (очереди) и повторы.

FAINT.ajax({url: url, type: 'POST', data: {a:'b'})
     .then(function(data) {
	//...
     })
     .catch(function(error) {
	//...
     });

Под капотом перевызывает jQuery.ajax, но не принимает функции complete, success, error (игнорирует их простановку), а так же принимает доппараметры:

  • queue - если передана строка, то использует очередь с таким именем. Два запроса с одинаковым значением queue не будут выполнены одновременно (кроме неопределенных значений queue).
FAINT.ajax({url: url1, queue: 'gps', data: geopos, type: 'POST'})
     .then(function(data) {

     });

FAINT.ajax({url: url2, queue: 'gps', data: geopos, type: 'POST'})
     .then(function(data) {

     });

Данный пример отправляет координаты по двум урлам и гарантирует что одновременно в два урла не будет выполняться запросов.

  • repeat - правило повторов.

Здесь передается имя правила повторов.

Сами правила описываются при инициализации плагина:

FAINT.init({
	ajax: {
		repeats: {
			gps: {
				intervals: [1, 2, 4, 8],
				after: [ /5../ ],
				forever: true
			}
		}
	}
})

Вышеприведенный пример будет бесконечно повторять запрос после пятисоток (сетевые ошибки приравниваются к кодам 595, 596), первый повтор будет выполнен через секунду, второй - через две, четвертый и остальные - через 8 секунд.

Eсли forever==false то повторов будет ровно столько сколько указано и после последнего будет возвращена ошибка.