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

Commit2662b04

Browse files
authored
Merge pull requestcoderoad#515 from coderoad/codeally-lauunch-on-stratup
launch on codeally.json
2 parentscba7f3c +2423618 commit2662b04

File tree

4 files changed

+33
-20
lines changed

4 files changed

+33
-20
lines changed

‎package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@
7272
"vscode":"^1.39.2"
7373
},
7474
"activationEvents": [
75-
"onCommand:coderoad.start"
75+
"onCommand:coderoad.start",
76+
"workspaceContains:**/codeally.json"
7677
],
7778
"categories": [
7879
"Other"

‎src/commands.ts

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import * as T from 'typings'
22
import*asTTfrom'typings/tutorial'
33
import*asvscodefrom'vscode'
44
importcreateTestRunnerfrom'./services/testRunner'
5-
importcreateWebViewfrom'./services/webview'
5+
importcreateWebViewfrom'./services/webview/create'
66
import*ashooksfrom'./services/hooks'
77
importloggerfrom'./services/logger'
88
importChannelfrom'./channel'
@@ -32,29 +32,35 @@ export const send = (action: T.Action): void => {
3232
if(action)sendToClient(action)
3333
}
3434

35-
exportconstcreateCommands=({ extensionPath, workspaceState}:CreateCommandProps):{[key:string]:any}=>{
35+
exportconstcreateCommands=(commandProps:CreateCommandProps):{[key:string]:any}=>{
36+
console.log(commandProps)
37+
const{ extensionPath, workspaceState}=commandProps
3638
// React panel webview
3739
letwebview:any
3840
letcurrentPosition:T.Position
3941
lettestRunner:any
4042
constchannel=newChannel(workspaceState)
4143

44+
conststart=async()=>{
45+
if(webview&&webview.state.loaded){
46+
webview.createOrShow()
47+
}else{
48+
// activate machine
49+
webview=awaitcreateWebView({
50+
extensionPath,
51+
channel,
52+
})
53+
// make send to client function exportable
54+
// as "send".
55+
sendToClient=webview.send
56+
}
57+
}
58+
59+
// run activation if triggered by "workspaceContains"
60+
start()
61+
4262
return{
43-
// initialize
44-
[COMMANDS.START]:async()=>{
45-
if(webview&&webview.state.loaded){
46-
webview.createOrShow()
47-
}else{
48-
// activate machine
49-
webview=awaitcreateWebView({
50-
extensionPath,
51-
channel,
52-
})
53-
// make send to client function exportable
54-
// as "send".
55-
sendToClient=webview.send
56-
}
57-
},
63+
[COMMANDS.START]:start,
5864
[COMMANDS.CONFIG_TEST_RUNNER]:async({
5965
data,
6066
alreadyConfigured,

‎src/services/webview/index.tsrenamed to‎src/services/webview/create.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ interface Output {
1818
conststate={loaded:false}
1919

2020
constcreateReactWebView=({ extensionPath, channel}:ReactWebViewProps):Output=>{
21+
// throttle "already open" popup
22+
letlastWebviewOpenedAt=newDate()
23+
2124
// TODO add disposables
2225
constdisposables:vscode.Disposable[]=[]
2326

@@ -78,11 +81,14 @@ const createReactWebView = ({ extensionPath, channel }: ReactWebViewProps): Outp
7881
// Otherwise, create a new panel.
7982

8083
if(panel&&panel.webview){
81-
vscode.window.showInformationMessage('CodeRoad already open')
84+
if(Date.now()-lastWebviewOpenedAt.getTime()>5000){
85+
vscode.window.showInformationMessage('CodeRoad already open')
86+
}
8287
panel.reveal(vscode.ViewColumn.Two)
8388
}else{
8489
panel=createWebViewPanel()
8590
}
91+
lastWebviewOpenedAt=newDate()
8692
},
8793
send,
8894
receive,

‎web-app/.env.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
SKIP_PREFLIGHT_CHECK=true
2-
VERSION=0.14.2
2+
VERSION=0.14.5
33
NODE_ENV=local
44
REACT_APP_DEBUG=false
55
REACT_APP_LOG=false

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp