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

state-tokens

v1.0.1

Published

Classes and type definitions for state transition tokens for libraries that manage tokens as objects in sets and tables.

Downloads

8

Readme

state-tokens

Classes and type definitions for state transition tokens for libraries that manage tokens as objects in sets and tables.

install

npm install -save state-tokens

usage

const { 
    TransitionObject, 
    LoginTransitionObject, 
    LogoutTransitionObject, 
    RegistrationTransitionObject, 
    ProcessTransitionObject
} = require("state-tokens")

...

function using_tokens() {

	let lt_object = new LoginTransitionObject('user')  // for user processing
	let pt_object = new ProcessTransitionObject('media') // for media operations
	
	// set the token of the transition object (not a constructor parameter)
	// The token will be useless to most apps if the token is not set.
	let session_token = app_token_maker()
	lt_object.set_token(session_token)
	let process_token= app_token_maker()
	pt_object.set_token(process_token)

	let tok = pt_object.token // fields are public...
}

These objects may be stored and fetched by their token key.

The base type, TransitionObject, has fields for identifying its location in a process chain. In particular, the secondary_action field can be used to check if the token should do some second action. Within copious-transitions for example, a browser could check to see if more operations should be performed by a server until an operation is completed; that is, the operation may take a few steps and use server side and client side views of the token to decide how to proceed through a process.

The token object also has fields elements, object, initially empty, and also amelioritive_action which if set, may be used to direct the server as to how to handle process error events in relation to other processes or a browser client.

More information is available in the JSDOC output.