mirror of
				https://github.com/Gongxh0901/kunpolibrary
				synced 2025-10-31 03:15:45 +00:00 
			
		
		
		
	仓库中添加内置的demo
This commit is contained in:
		
							
								
								
									
										20
									
								
								demo/assets/script/Helper/NativeCallJS.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								demo/assets/script/Helper/NativeCallJS.ts
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,20 @@ | ||||
| /** | ||||
|  * @Author: Gongxh | ||||
|  * @Date: 2025-03-22 | ||||
|  * @Description:  | ||||
|  */ | ||||
|  | ||||
| function KunpoNativeCallJsHandler(jsonString: string) { | ||||
|     console.log("KunpoNativeCallJsHandler", jsonString); | ||||
|     // let json = JSON.parse(jsonString); | ||||
|     // let functionName = json.function; | ||||
|     // let args = json.args; | ||||
|     // let func = _global[functionName]; | ||||
|     // if (func) { | ||||
|     //     func(...args); | ||||
|     // } | ||||
| } | ||||
|  | ||||
|  | ||||
| let _global = globalThis || window || global; | ||||
| (_global as any)["KunpoNativeCallJsHandler"] = KunpoNativeCallJsHandler; | ||||
							
								
								
									
										9
									
								
								demo/assets/script/Helper/NativeCallJS.ts.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								demo/assets/script/Helper/NativeCallJS.ts.meta
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,9 @@ | ||||
| { | ||||
|   "ver": "4.0.24", | ||||
|   "importer": "typescript", | ||||
|   "imported": true, | ||||
|   "uuid": "6dd5b452-10ce-4d6c-9013-c0c991560dd7", | ||||
|   "files": [], | ||||
|   "subMetas": {}, | ||||
|   "userData": {} | ||||
| } | ||||
							
								
								
									
										27
									
								
								demo/assets/script/Helper/SDKHelper.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								demo/assets/script/Helper/SDKHelper.ts
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,27 @@ | ||||
| /** | ||||
|  * @Author: Gongxh | ||||
|  * @Date: 2025-03-22 | ||||
|  * @Description:  | ||||
|  */ | ||||
|  | ||||
| import { GlobalEvent } from "kunpocc-event"; | ||||
|  | ||||
| export class SDKHelper { | ||||
|     private static _manifestUrl: string = ""; | ||||
|     public static getSystemInfo(): Promise<{ version: string, build: number }> { | ||||
|         return new Promise((resolve, reject) => { | ||||
|             KunpoSDK.SDKHelper.getInstance().getSystemInfo(); | ||||
|             GlobalEvent.addOnce("calljs::getSystemInfo", (data: { version: string, build: number }) => { | ||||
|                 resolve(data); | ||||
|             }, this); | ||||
|         }); | ||||
|     } | ||||
|  | ||||
|     public static set manifestUrl(url: string) { | ||||
|         this._manifestUrl = url; | ||||
|     } | ||||
|  | ||||
|     public static get manifestUrl(): string { | ||||
|         return this._manifestUrl; | ||||
|     } | ||||
| } | ||||
							
								
								
									
										9
									
								
								demo/assets/script/Helper/SDKHelper.ts.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								demo/assets/script/Helper/SDKHelper.ts.meta
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,9 @@ | ||||
| { | ||||
|   "ver": "4.0.24", | ||||
|   "importer": "typescript", | ||||
|   "imported": true, | ||||
|   "uuid": "76eb0078-54f0-400d-a151-68586eaa78f3", | ||||
|   "files": [], | ||||
|   "subMetas": {}, | ||||
|   "userData": {} | ||||
| } | ||||
		Reference in New Issue
	
	Block a user