MCPcopy
hub / github.com/chavyleung/scripts / updateCurSesssions

Function updateCurSesssions

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

Source from the content-addressed store, hash-verified

1111}
1112
1113function updateCurSesssions(appId, data) {
1114 if (!appId) {
1115 console.log(`[updateCurSesssions] 跳过! 没有指定 appId!`)
1116 return
1117 }
1118
1119 const curSessions = getCurSessions()
1120 const curSessionId = curSessions[appId]
1121 if (!curSessionId) {
1122 console.log(
1123 `[updateCurSesssions] 跳过! 应用 [${appId}] 找不到当前会话, 请先应用会话!`
1124 )
1125 return
1126 }
1127
1128 const sessions = getAppSessions()
1129 const session = sessions.find((session) => session.id === curSessionId)
1130 if (!session) {
1131 console.log(
1132 `[updateCurSesssions] 跳过! 应用 [${appId}] 找不到当前会话, 请先应用会话!`
1133 )
1134 return
1135 }
1136
1137 session.datas = data
1138 $.setjson(sessions, $.KEY_sessions)
1139}
1140
1141/**
1142 * ===================================

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

Used in the wild real call sites across dependent graphs

searching dependent graphs…