import 'colors' ; import Cache from './Cache' ; import TokenHandler from './TokenHandler' ; import NI from './NetworkInterface' ; import QQ from './QueryQueue' ; import log from 'winston' ; function handleErrors ( e ) { console . error ( e . message . red ) ; console . error ( 'NOTE: Check your debug log for stack trace' . grey ) ; log . debug ( e ) ; } export default function ( token ) { ( process as NodeJS . EventEmitter ) . on ( 'error' , handleErrors ) ; process . on ( 'unhandledRejection' , handleErrors ) ; process . on ( 'uncaughtException' , handleErrors ) ; TokenHandler . setToken ( token ) ; Cache . init ( ) ; NI . init ( ) ; QQ . init ( ) ; }