mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
* Added comments and updated definitions * enabled allowSyntheticDefaultImports * changed exports style and updated tests
30 lines
590 B
TypeScript
30 lines
590 B
TypeScript
import * as 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'
|
|
});
|