Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

alanjames1987/annyang-node

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

18 Commits

Repository files navigation

annyang-node

NPM version

A JavaScript library for keyword based initiation of callback functions.

This is a partial port of the amazing annyang client side library by Tal Ater for Node.js.

Just like the client version, annyang has no dependencies and is free to use and modify under the MIT license.

Usage

Install the module with npm: $ npm install annyang

Just require the annyang library in your Node application, instantiate a new Annyang object, and define the commands you want.

var Annyang = require('annyang');
var annyang = new Annyang();
// Let's define a command.
var commands = {
	'show tps report': function() { 
		// do something 
	}
};
// Initialize our commands with annyang
annyang.init(commands);
// Trigger a command
annyang.trigger('show tps report');

Because annyang-node is used on the server side a new instance should be made each time you want to use it. This helps with serving the correct content to the correct user via a WebSocket.

For a full reference of how the keyword matching works reference the official annyang site: https://www.talater.com/annyang/

Author

Alan James: alanjames1987@gmail.com

License

Licensed under MIT.

About

A JavaScript library for keyword based initiation of callback functions.

Resources

License

Stars

Watchers

Forks

Packages

Contributors

AltStyle によって変換されたページ (->オリジナル) /