MCPcopy Create free account
hub / github.com/chavyleung/scripts / updateCurSesssions

Function updateCurSesssions

chavy.box.js:1172–1198  ·  view source on GitHub ↗
(appId, data)

Source from the content-addressed store, hash-verified

1170}
1171
1172function updateCurSesssions(appId, data) {
1173 if (!appId) {
1174 console.log(`[updateCurSesssions] 跳过! 没有指定 appId!`)
1175 return
1176 }
1177
1178 const curSessions = getCurSessions()
1179 const curSessionId = curSessions[appId]
1180 if (!curSessionId) {
1181 console.log(
1182 `[updateCurSesssions] 跳过! 应用 [${appId}] 找不到当前会话, 请先应用会话!`
1183 )
1184 return
1185 }
1186
1187 const sessions = getAppSessions()
1188 const session = sessions.find((session) => session.id === curSessionId)
1189 if (!session) {
1190 console.log(
1191 `[updateCurSesssions] 跳过! 应用 [${appId}] 找不到当前会话, 请先应用会话!`
1192 )
1193 return
1194 }
1195
1196 session.datas = data
1197 $.setjson(sessions, $.KEY_sessions)
1198}
1199
1200/**
1201 * ===================================

Callers 1

apiSaveFunction · 0.70

Calls 4

getCurSessionsFunction · 0.70
getAppSessionsFunction · 0.70
logMethod · 0.45
setjsonMethod · 0.45

Tested by

no test coverage detected