Explore tweets tagged as #WeakMap
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
2
0
12
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
0
1
5
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
1
0
8
๐ฅ 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
0
0
1
ุนู
ุฑู ุณู
ุนุช ุจุงูู WeakMap ูู JavaScriptุ ๐ค.ูู ุนุจุงุฑุฉ ุนู Map ุนุงุฏูุฉ ููููุง ุชุนุงู
ู ุงูู Keys ูู Weak Reference. ๐ฏ ููุด ู
ูู
ุฉุ.ูุงููุง ุชู
ูุน ุงููmemory leak ูู
ู
ุชุงุฒุฉ ูู
ุฎุฒู ุงู ูู cache. โ
ููู ุงูุญุฐู ุงูู Object ุฎุงุฑุฌููุงุ ุงููWeakMap ูุนุทู ุงูุถูุก ุงูุฃุฎุถุฑ ููGarbage Collector ุนุดุงู ูุญุฐูู ุชููุงุฆููุง. 1/2
1
1
5
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
1
0
0
๐ 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.
6
3
18