Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite02c0e2

Browse files
committed
cleanup webview dispose
1 parent65016c9 commite02c0e2

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

‎src/editor/ReactWebView.ts

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class ReactWebView {
2424

2525
// Listen for when the panel is disposed
2626
// This happens when the user closes the panel or when the panel is closed programatically
27-
this.panel.onDidDispose(()=>this.dispose(),null,this.disposables)
27+
this.panel.onDidDispose(this.dispose,this,this.disposables)
2828

2929
// Handle messages from the webview
3030
constonReceive=(action:string|CR.Action)=>{
@@ -91,16 +91,10 @@ class ReactWebView {
9191
}
9292
}
9393

94-
publicdispose():void{
94+
privateasyncdispose():Promise<void>{
9595
// Clean up our resources
9696
this.panel.dispose()
97-
98-
while(this.disposables.length){
99-
constx=this.disposables.pop()
100-
if(x){
101-
x.dispose()
102-
}
103-
}
97+
Promise.all(this.disposables.map((x)=>x.dispose()))
10498
}
10599

106100
privatecreateWebviewPanel(column:number):vscode.WebviewPanel{
@@ -153,14 +147,15 @@ class ReactWebView {
153147
<meta name='theme-color' content='#000000'>
154148
<title>React App</title>
155149
<link rel='manifest' href='./manifest.json' />
150+
156151
<!-- TODO: load styles through package -->
157152
<link rel='stylesheet' href='https://unpkg.com/@alifd/next/dist/next.css' />
158153
<link rel='stylesheet' type='text/css' href='${styleUri}'>
154+
159155
<meta http-equiv='Content-Security-Policy' content="font-src *; img-src vscode-resource: https:; script-src 'nonce-${n1}' 'nonce-${n2}' 'nonce-${n3}'; style-src vscode-resource: 'unsafe-inline' http: https: data:;">
160156
<base href='${vscode.Uri.file(path.join(this.extensionPath,'build')).with({
161157
scheme:'vscode-resource',
162158
})}/'>
163-
<style></style>
164159
</head>
165160
166161
<body>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp