Explore tweets tagged as #WeakMap
@serraotweets
John Serrao
2 years
The WeakMap JS definition on MDN is at least in the conversation for the worst definition of a concept I've ever read
Tweet media one
0
0
0
@krunalexplores
KrunalSinh Sisodia
3 months
WeakMap for Private Data ๐Ÿ”ฅ
Tweet media one
0
0
1
@ClassicOldSong
Yukino Song
1 year
"Symbols as WeakMap keys" proposal is now implemented in #ResonanceJS
Tweet media one
0
0
1
@sogldaniel
Daniel Sogl
7 months
๐Ÿ’ก JavaScript Tip of the Week!. Did you know that WeakMap and WeakSet are powerful tools for managing memory-sensitive data structures in JavaScript? They allow you to associate data with objects without preventing garbage collection, leading to more efficient memory usage. ๐Ÿš€
Tweet media one
Tweet media two
0
0
2
@sumit_analyzen
Sumit Saha
10 months
๐Ÿ’ก Node.js Pro Tip: Use WeakMap for lightweight caching to avoid memory leaks in long-running apps!.When you need to cache objects temporarily, WeakMap holds "weak" references to keys (usually objects), allowing garbage collection if the key object is no longer referenced.
Tweet media one
2
0
14
@codingnninja
Ayobami Ogundiran โœด๏ธ๐ŸŒŸโœด๏ธ
1 year
๐Ÿ‘๐Ÿป Successfully serialized WeakMap, WeakSet and others.
Tweet media one
0
0
2
@MasteringPinia
Mastering Pinia
22 days
Singleton Store: One Store to Rule Them All ๐Ÿ“ˆ. Ever accidentally create multiple copies of your store, leading to chaos? A WeakMap in defineStore guarantees there's only one instance per function. This keeps your state management predictable and efficient.
Tweet media one
1
1
38
@MasteringPinia
Mastering Pinia
11 months
Ever accidentally create multiple copies of your store, leading to chaos? ๐Ÿ‘€๐Ÿ. A WeakMap in defineStore guarantees there's only one instance per function. This keeps your state management predictable and efficient. #MasteringPinia #Pinia
Tweet media one
2
0
12
@sebinsua
Seb Insua
2 months
A little utility I came up with to avoid layout thrashing when scrolling or performing animations, etc. WeakMap + sliding TTL = auto-expiring cache!
Tweet media one
0
0
2
@sebmck
Sebastian
1 year
An awesome feature of tagged template literals that is definitely underutilized, is caching the computation of TemplateStringsArray in a WeakMap.
Tweet media one
1
5
29
@AdyaTech
Adya
1 year
You can use WeakMap to keep track of private data in JavaScript objects without exposing it.
Tweet media one
1
0
2
@sephr
๎จ€๐Ÿ•Š
1 year
I was looking at DOMPurify source code, and I have to say that this isn't safe. Attackers can pollute DOM prototypes with accessors that return expected 'internal' values (satisfying this check) on first access, with unexpected results on subsequent accesses. This needs WeakMap
Tweet media one
2
0
2
@satapathy9
sidharth satapathy
2 years
The #JavaScript WeakMap is a useful tool for creating memory-efficient maps that automatically release their entries when they are no longer in use. ๐Ÿง  #webdev #programming
Tweet media one
0
1
5
@iraacodes
Ira Mishra ๐ŸŒฑ
1 year
Day 21: Map, Set, & WeakMap ๐Ÿ—บ๏ธ๐Ÿš€.Powerful data structures for our programs!. Map: key-value pairs with any type of key. Set: collection of unique values. WeakMap: key-value pairs whose keys must be objects. :). Connect & learn JavaScript with me! ๐Ÿฅฐ.#100DaysOfCode.#30DaysOfJS
Tweet media one
1
0
8
@vishwaSayambar
Vishwajit Sayambar
7 months
๐Ÿ”ฅ Tip: Use WeakMap for efficient memory management & automatic garbage collection! ๐Ÿ—‘๏ธ๐Ÿš€. โšก Why use WeakMap?.โœ… Doesn't prevent garbage collection (unlike Map). โœ… Great for caching & private data storage. โœ… Keys must be objects (no primitives allowed). #javascript
Tweet media one
0
0
1
@F2TheL_
FAISAL
9 months
ุนู…ุฑูƒ ุณู…ุนุช ุจุงู„ู€ WeakMap ููŠ JavaScriptุŸ ๐Ÿค”.ู‡ูŠ ุนุจุงุฑุฉ ุนู† Map ุนุงุฏูŠุฉ ู„ูƒู†ู‡ุง ุชุนุงู…ู„ ุงู„ู€ Keys ูƒู€ Weak Reference. ๐ŸŽฏ ู„ูŠุด ู…ู‡ู…ุฉุŸ.ู„ุงู†ู‡ุง ุชู…ู†ุน ุงู„ู€memory leak ูˆู…ู…ุชุงุฒุฉ ูƒู…ุฎุฒู† ุงูˆ ูƒู€ cache. โœ… ูู„ูˆ ุงู†ุญุฐู ุงู„ู€ Object ุฎุงุฑุฌูŠู‹ุงุŒ ุงู„ู€WeakMap ูŠุนุทูŠ ุงู„ุถูˆุก ุงู„ุฃุฎุถุฑ ู„ู€Garbage Collector ุนุดุงู† ูŠุญุฐูู‡ ุชู„ู‚ุงุฆูŠู‹ุง. 1/2
Tweet media one
1
1
5
@muhimasri
Muhi Masri
1 year
๐Ÿ’ก I mentioned before the advantage of using WeakMap to store DOM elements metadata. However, caching also has advantages when comparing WeakMap vs Map. - WeakMap: Keys are weakly held, allowing for automatic garbage collection if no other references exist to the object. Ideal
Tweet media one
2
1
8
@miguderp
Miguel Peixe Aldeias
5 months
Anyone knows how to animate #ogl objects? Something simple like `animate(this.sceneQuat, new Quat(0, 0, 0, 1), { duration: 0.7, ease: "easeInOut" });` throws me a WeakMap error (TypeError: Invalid value used as weak map key). Iโ€™m pretty sure threejs easily allows similar
Tweet media one
1
0
0
@muhimasri
Muhi Masri
1 year
๐Ÿ”Ž An excellent use case of #JavaScript `WeakMap` is associating metadata with DOM elements without preventing them from being garbage collected. This is especially useful in scenarios where you want to attach data to DOM elements but don't want to risk memory leaks.
Tweet media one
6
3
18