The WeakMap object is a collection of key/value pairs in which the keys are weakly referenced. The keys must be objects and the values can be arbitrary values.
Inheritance: ClrStubFunction
Ejemplo n.º 1
0
        /// <summary>
        /// Creates the WeakMap prototype object.
        /// </summary>
        /// <param name="engine"> The script environment. </param>
        /// <param name="constructor"> A reference to the constructor that owns the prototype. </param>
        internal static ObjectInstance CreatePrototype(ScriptEngine engine, WeakMapConstructor constructor)
        {
            var result     = engine.Object.Construct();
            var properties = GetDeclarativeProperties(engine);

            properties.Add(new PropertyNameAndValue("constructor", constructor, PropertyAttributes.NonEnumerable));
            properties.Add(new PropertyNameAndValue(engine.Symbol.ToStringTag, "WeakMap", PropertyAttributes.Configurable));
            result.InitializeProperties(properties);
            return(result);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Creates the WeakMap prototype object.
 /// </summary>
 /// <param name="engine"> The script environment. </param>
 /// <param name="constructor"> A reference to the constructor that owns the prototype. </param>
 internal static ObjectInstance CreatePrototype(ScriptEngine engine, WeakMapConstructor constructor)
 {
     var result = engine.Object.Construct();
     var properties = GetDeclarativeProperties(engine);
     properties.Add(new PropertyNameAndValue("constructor", constructor, PropertyAttributes.NonEnumerable));
     properties.Add(new PropertyNameAndValue(engine.Symbol.ToStringTag, "WeakMap", PropertyAttributes.Configurable));
     result.FastSetProperties(properties);
     return result;
 }