This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Available variables: | |
// - Machine | |
// - interpret | |
// - assign | |
// - send | |
// - sendParent | |
// - spawn | |
// - raise | |
// - actions |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//optional | |
//Takes an interface and enforces its keys but optionally. | |
//SO SO handy! | |
type Partial<T> = { | |
[p in keyof T]?: T[p] | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//custom middlewhare | |
mount.use( function( req, res, next ) { | |
//trap any render function call for this mount | |
res.render = new Proxy(res.render,{ | |
apply(target, thisArg, argumentsList){ | |
//DI data intercept | |
//BEWARE, i have not added if statements for the potential render arguments | |
//push a callback | |
//you could push a data object here. | |
//you could even catch errors and render that! |