2026-05-21 23:40:20 -07:00
package js . lib ;
2025-01-22 16:18:30 +01:00
/ *
* Copyright ( C ) 2005 - 2019 Haxe Foundation
*
* Permission is hereby granted , free of charge , to any person obtaining a
* copy of this software and associated documentation files ( the " S o f t w a r e " ) ,
* to deal in the Software without restriction , including without limitation
* the rights to use , copy , modify , merge , publish , distribute , sublicense ,
* and / or sell copies of the Software , and to permit persons to whom the
* Software is furnished to do so , s u b j e c t t o t h e f o l l o w i n g c o n d i t i o n s :
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software .
*
* THE SOFTWARE IS PROVIDED " A S I S " , WITHOUT WARRANTY OF ANY KIND , EXPRESS OR
* IMPLIED , INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY ,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT . IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM , DAMAGES OR OTHER
* LIABILITY , WHETHER IN AN ACTION OF CONTRACT , TORT OR OTHERWISE , ARISING
* FROM , OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE .
* /
/ * *
2026-05-21 23:40:20 -07:00
The ` WeakRef ` object lets you hold a weak reference to another object , without preventing that object from getting garbage - collected .
Documentation [ WeakRef ] ( https : //developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakRef) by [Mozilla Contributors](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakRef$history), licensed under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/).
2025-01-22 16:18:30 +01:00
* * /
2026-05-21 23:40:20 -07:00
@ : native ( " W e a k R e f " )
extern class WeakRef < T : { } > {
/ * *
Creates a new WeakRef o b j e c t .
* * /
@ : pure function n e w ( target : T ) ;
/ * *
Returns the WeakRef object ' s t a r g e t o b j e c t , o r n u l l i f t h e t a r g e t o b j e c t h a s b e e n r e c l a i m e d .
* * /
@ : pure function deref ( ) : Null < T > ;
}