| 1350 | } |
| 1351 | |
| 1352 | func (r *Runtime) cleanupClassObjectIdentitiesByContext(contextID uint64) { |
| 1353 | if r == nil || contextID == 0 { |
| 1354 | return |
| 1355 | } |
| 1356 | bucketValue, ok := r.classObjectIDsByCtx.LoadAndDelete(contextID) |
| 1357 | if !ok { |
| 1358 | return |
| 1359 | } |
| 1360 | bucket, ok := bucketValue.(*sync.Map) |
| 1361 | if !ok { |
| 1362 | return |
| 1363 | } |
| 1364 | bucket.Range(func(key, _ interface{}) bool { |
| 1365 | objectID, ok := key.(int32) |
| 1366 | if !ok { |
| 1367 | return true |
| 1368 | } |
| 1369 | r.classObjectRegistry.Delete(objectID) |
| 1370 | return true |
| 1371 | }) |
| 1372 | } |
| 1373 | |
| 1374 | func (r *Runtime) registerConstructorClassID(constructor C.JSValue, classID uint32) { |
| 1375 | if r == nil { |