import { WeApp } from './common/common' ; class WeAppClass implements WeApp { public get globalData ( ) { return { userInfo : null } ; } public onLaunch ( ) { const logs = wx . getStorageSync ( 'logs' ) || [ ] ; logs . unshift ( Date . now ( ) ) ; wx . setStorageSync ( 'logs' , logs ) ; } public getUserInfo ( cb ) { if ( this . globalData . userInfo ) { typeof cb == "function" && cb ( this . globalData . userInfo ) ; } else { wx . login ( { success : ( ) => { wx . getUserInfo ( { success : res => { this . globalData . userInfo = res . userInfo ; typeof cb == "function" && cb ( this . globalData . userInfo ) ; } } ) ; } } ) ; } } } ; App ( new WeAppClass ( ) ) ;