perf: prioritize loading of communication function that require return values
This commit is contained in:
		
							
								
								
									
										42
									
								
								src/home.ts
									
									
									
									
									
								
							
							
						
						
									
										42
									
								
								src/home.ts
									
									
									
									
									
								
							@@ -41,27 +41,7 @@ export default class DSHome {
 | 
			
		||||
      async (message) => {
 | 
			
		||||
        const data = message.data
 | 
			
		||||
        const need_return = message.need_return
 | 
			
		||||
        if (!need_return) {
 | 
			
		||||
          // ================= don't need return ==============
 | 
			
		||||
          // frequent
 | 
			
		||||
          switch (message.command) {
 | 
			
		||||
            // ----------------- frequent -----------------------
 | 
			
		||||
            case 'showInformationNotification':
 | 
			
		||||
              vscode.window.showInformationMessage(data.message);
 | 
			
		||||
              break;
 | 
			
		||||
            case 'showWarningNotification':
 | 
			
		||||
              vscode.window.showWarningMessage(data.message)
 | 
			
		||||
              break;
 | 
			
		||||
            case 'showErrorNotification':
 | 
			
		||||
              const selection = await vscode.window.showErrorMessage(data.message, 'Open Console', 'Report a problem',);
 | 
			
		||||
              if (selection === 'Open Console') {
 | 
			
		||||
                vscode.commands.executeCommand('workbench.action.toggleDevTools');
 | 
			
		||||
              } else if (selection === 'Report a problem') {
 | 
			
		||||
                vscode.commands.executeCommand('vscode.open', vscode.Uri.parse('https://gitee.com/SuperIDE/DevStar/issues'));
 | 
			
		||||
              }
 | 
			
		||||
              break;
 | 
			
		||||
          }
 | 
			
		||||
        } else {
 | 
			
		||||
        if (need_return) {
 | 
			
		||||
          // ================= need return ====================
 | 
			
		||||
          switch (message.command) {
 | 
			
		||||
            // ----------------- frequent -----------------------
 | 
			
		||||
@@ -152,6 +132,26 @@ export default class DSHome {
 | 
			
		||||
              }
 | 
			
		||||
              panel.webview.postMessage({ command: 'getDefaultPublicKey', data: { defaultPublicKey: defaultPublicKey } })
 | 
			
		||||
          }
 | 
			
		||||
        } else {
 | 
			
		||||
          // ================= don't need return ==============
 | 
			
		||||
          // frequent
 | 
			
		||||
          switch (message.command) {
 | 
			
		||||
            // ----------------- frequent -----------------------
 | 
			
		||||
            case 'showInformationNotification':
 | 
			
		||||
              vscode.window.showInformationMessage(data.message);
 | 
			
		||||
              break;
 | 
			
		||||
            case 'showWarningNotification':
 | 
			
		||||
              vscode.window.showWarningMessage(data.message)
 | 
			
		||||
              break;
 | 
			
		||||
            case 'showErrorNotification':
 | 
			
		||||
              const selection = await vscode.window.showErrorMessage(data.message, 'Open Console', 'Report a problem',);
 | 
			
		||||
              if (selection === 'Open Console') {
 | 
			
		||||
                vscode.commands.executeCommand('workbench.action.toggleDevTools');
 | 
			
		||||
              } else if (selection === 'Report a problem') {
 | 
			
		||||
                vscode.commands.executeCommand('vscode.open', vscode.Uri.parse('https://gitee.com/SuperIDE/DevStar/issues'));
 | 
			
		||||
              }
 | 
			
		||||
              break;
 | 
			
		||||
          }
 | 
			
		||||
        }
 | 
			
		||||
      },
 | 
			
		||||
      undefined,
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user