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

fast-event-system

v1.0.11

Published

This fast event system allows calls between two interfaces decoupled (sync or async)

Downloads

18

Readme

Fast Event System

npm version state dependencies state dev dependencies

Coverage: codecov

gcc 4.9 / clang 3.6: Build Status

MSVC 2015: Build status

quick-start

$ git clone --recursive [email protected]:makiolo/fast-event-system.git fes
$ cd fes
$ npm install
$ npm test

Very simple to use

Fast event system is a library for resolve observer pattern in a functional way. Is a library very easy to use, only have 3 objects: sync, async_fast and async_delay.

sync

I will explain sync object with minimal examples:

// instanciate
fes::sync<bool> key_A;

Now, you can connect functors, lambdas ...:

key_A.connect([](bool press)
	{
		if(press)
			std::cout << "pressed key A" << std::endl;
		else
			std::cout << "released key A" << std::endl;
	});

And finally, something notify using operator() and all functors connected will receive this.

key_A(true);  // notify to subscribers

All objetcs in fes, use variadic templates, new interfaces can be created in compile time:

fes::sync<std::string, int, std::string> civiian;
civiian.connect([](const std::string& name, int age, const std::string& country)
	{
		// process input ...
		std::cout << "new civiian registered" << std::endl;
	});

async_fast

Works equal than sync but data is saved in buffer.

key_A(true);  // saved in queue
key_A(true);  // saved in queue
key_A(true);  // saved in queue

Now, we have three messages waiting in queue. For dispatching, type:

key_A.update();  // notify to subscribers

async_delay

Works equal than async_fast but data can send delayed. The time delayed is specified in first parameter of operator() with help of fes::deltatime():

key_A(fes::deltatime(2000), true);  // saved in queue (with your delayed time)

We can use .update() for dispatching, now have a parameter for config timeout:

// 2000 ms after, message is notify to subscribers
key_A.update(fes::deltatime(5000));

Previous line, wait 5000 ms or finish when one message is dispatched. For default, timeout is 16ms. For dispatching a fixed time(dispathing multiples messages), you can use .fortime():

key_A.fortime(fes::deltatime(5000));

Documentation under construction