import createDebugger from 'debug' ; import { environment } from '../environment' ; import Action from './Action' ; param { string } namespace export function debugActions ( namespace ) { return function logDecorator < T extends new ( ... constructorArgs ) => any > ( constructor ) { if ( ! environment . DEBUG ) { return constructor ; } return class extends constructor { constructor ( ... rest ) { super ( ) ; const debug = createDebugger ( namespace ) ; Reflect . ownKeys ( this ) . forEach ( ( key ) => { const action = this [ key as string ] as Action < any > ; action . onAction ( ( props ) => { debug ( key , props ) ; } ) ; } ) ; } } ; } ; }