tico-basics
v1.0.1
Published
Just basic stuff that I use in all my projects
Readme
Tico Basics
Tico Basics is a lightweight utility package providing essential tools for event handling and logging in JavaScript/TypeScript projects.
Features
- Events Module – Utilities to handle events easily and efficiently
- Logs Module – Colorful logging with
chalksupport for readable console output
Installation
npm install tico-basicsUsage
import { EventSystem, Logger } from "tico-basics";
// Define your event types (optional, recommended for TypeScript)
interface Events {
"test": [string, number];
}
// Create a Logger instance
const log = new Logger("MyApp");
// Create an EventSystem instance with typed events
const events = new EventSystem<Events>({
debug: true, // enables internal debug logging
}, log);
// Logger usage
log.info("Application starting");
log.success("Application started");
log.warn("This is a warning");
log.error("This is an error");
// Measure execution time
log.time("Startup");
// ... initialization code
log.timeEnd("Startup");
// Register and emit events
events.on("test", (message, code) => {
log.info(`Event received: ${message} (${code})`);
});
events.emit("test", "Hello World", 123);Build
If you want to rebuild the package from source:
npm run buildLicense
This project is licensed under AGPL-3.0-only – see the LICENSE file for details.
Author
tiaguinho2009 – GitHub
