import { promiseifyApi , wcScope } from '../../modules/util' ; import { WcCustomAction , WcCustomActionShowMode } from '../../types/other' ; const WcScope = wcScope ( ) ; export const SystemInfoCustomAction = { id : 'NativeInfo' , title : '内置信息' , autoCase : 'SystemInfo' , cases : [ { id : 'SystemInfo' , button : '系统信息' , showMode : WcCustomActionShowMode . json , handler ( ) { return promiseifyApi ( 'getSystemInfo' ) ; } } , { id : 'Global' , button : 'Global对象' , showMode : WcCustomActionShowMode . json , handler ( ) { return typeof global !== 'undefined' ? global : undefined ; } } , { id : 'App' , button : 'App对象' , showMode : WcCustomActionShowMode . json , handler ( ) { return getApp ( { allowDefault : true } ) ; } } , { id : 'CurrentPage' , button : '当前页面实例' , showMode : WcCustomActionShowMode . json , handler ( ) { const pages = getCurrentPages ( ) ; return pages ?. length ? pages [ pages . length - 1 ] : undefined ; } } ] } ; const demoActions = [ ] ; export const getCustomActions = ( ) : WcCustomAction [ ] => { const res = [ SystemInfoCustomAction , ... demoActions ] ; const config = WcScope . UIConfig ; if ( config ?. customActions && config . customActions . length ) { return res . concat ( config . customActions ) ; } return res ; } ;