| 38 | } |
| 39 | |
| 40 | function resolveMethodName(method: any) { |
| 41 | if (!method) { |
| 42 | return ''; |
| 43 | } |
| 44 | const type = typeof method; |
| 45 | if (type === 'string') { |
| 46 | return method; |
| 47 | } |
| 48 | if (type === 'function' || type === 'object') { |
| 49 | if (method.name) { |
| 50 | return method.name.charAt(0).toUpperCase() + method.name.slice(1); |
| 51 | } |
| 52 | if (method.fullName) { |
| 53 | const parts = String(method.fullName).split('.'); |
| 54 | return parts[parts.length - 1]; |
| 55 | } |
| 56 | } |
| 57 | return String(method); |
| 58 | } |
| 59 | |
| 60 | export function getVmmRpcClient(basePath = '/prpc') { |
| 61 | if (cachedClient) { |