mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-12-03 19:51:53 +00:00
new package: burns
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
import burns from 'burns';
|
||||
|
||||
interface OrderData {
|
||||
userName: string;
|
||||
orderId: string;
|
||||
}
|
||||
|
||||
function handleEverything() {
|
||||
console.log('Do absolutely nothing! 😄');
|
||||
}
|
||||
|
||||
function sendEmail(message: string) {
|
||||
console.log(message);
|
||||
}
|
||||
|
||||
function sendOrderShippedEmail(data: OrderData) {
|
||||
sendEmail(`Hi ${data.userName}, Your order ${data.orderId} has been shipped`);
|
||||
}
|
||||
|
||||
burns.configure({
|
||||
defaultHandler: handleEverything
|
||||
});
|
||||
burns.registerEvents({
|
||||
newPurchase: sendOrderShippedEmail
|
||||
});
|
||||
burns.dispatch('newPurchase', {
|
||||
userName: 'Johnny',
|
||||
orderId: 'rand'
|
||||
});
|
||||
Vendored
+26
@@ -0,0 +1,26 @@
|
||||
// Type definitions for burns version 2.0.1
|
||||
// Project: https://github.com/shalvah/burns
|
||||
// Definitions by: Timothy Onyiuke <https://github.com/timolinn>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare const _Burns: Burns;
|
||||
|
||||
export interface Config {
|
||||
defaultHandler?: any;
|
||||
broadcaster?: any;
|
||||
pusher?: any;
|
||||
}
|
||||
|
||||
export interface ObjectLiteral {
|
||||
[key: string]: any
|
||||
}
|
||||
|
||||
declare class Burns {
|
||||
configure(config?: Config): this;
|
||||
|
||||
registerEvents(newEvents: ObjectLiteral): this;
|
||||
|
||||
dispatch(eventName: string, eventData?: ObjectLiteral, exclude?: { exclude?: any }): this;
|
||||
}
|
||||
|
||||
export default _Burns;
|
||||
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"burns-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user