c1200s-sdk
v1.0.0
Published
C1200s SDK
Downloads
2
Readme
C1200's SDK
EventEmitter
Require:
const EventEmitter = require("c1200s-sdk/eventemitter");
// OR
const EventEmitter = require("c1200s-sdk").EventEmitter;
Initiate:
class MyClass extends EventEmitter {
constructor() {
super();
}
}
Trigger an event:
this.emit();
Register a listener:
this.on();
// OR
this.once();
// OR
this.addListener(); // Just an alias of on()
Formatter
Require:
const format = require("c1200s-sdk/formatter");
// OR
const format = require("c1200s-sdk").format;
Use:
"Hello, {}!".format("World"); // => Hello, World!
// OR
format("Hello, {}!", "World"); // => Hello, World!
Logger
Require:
const Logger = require("c1200s-sdk/logger");
// OR
const Logger = require("c1200s-sdk").Logger;
Initiate:
var options = {
showTime: Boolean, // Default: true
};
const log = new Logger(options);
Use:
// Info
log.info("Hello, World!");
// Warn
log.warn("Hello, World!");
// Error
log.error("Hello, World!");
Created by C1200 - Licensed under the ISC software license.