NoahYoung
NoahYoung
  • 发布:2024-11-08 11:29
  • 更新:2024-11-08 11:29
  • 阅读:286

插件webviewPanel的onDidDispose注册事件不触发是什么原因?

分类:HBuilderX

是这个接口没开放使用?还是我使用方法有问题?ಠಿ_ಠ

extension.json,完整测试样例见附件

var hx = require("hbuilderx");  

//该方法将在插件激活的时候调用  
function activate(context) {  
    let webviewPanel = hx.window.createWebView("test.webview_id", {  
        enableScritps: true  
    })   

    webviewPanel.webView.html = "<h1>Webview将会自动销毁</h1>"  

    webviewPanel.onDidDispose(() => {  
        console.log("!!!对象已销毁")  
    })  

    setTimeout(() => {  
        console.log("!!!销毁webview")  
        webviewPanel.dispose()  
        webviewPanel = null  
    }, 3000)  

    hx.window.showView({  
        viewId: "test.webview_id",  
        containerId: "testWebviewContainer"  
    })  

    // context.subscriptions.push(webviewPanel)  
}  
//该方法将在插件禁用的时候调用(目前是在插件卸载的时候触发)  
function deactivate() {  

}  
module.exports = {  
    activate,  
    deactivate  
}  
2024-11-08 11:29 负责人:无 分享
已邀请:

要回复问题请先登录注册