Example #1
0
        public static UuidPrototype CreatePrototypeObject(Engine engine, UuidConstructor ctor)
        {
            var obj = new UuidPrototype(engine)
            {
                PrimitiveValue = JsUuid.Empty,
                _prototype     = engine.Realm.Intrinsics.Object.PrototypeObject,
            };

            obj.FastAddProperty("constructor", ctor, false, false, true);

            return(obj);
        }
Example #2
0
        public static UuidConstructor CreateUuidConstructor(Engine engine)
        {
            var obj = new UuidConstructor(engine)
            {
                // The value of the [[Prototype]] internal property of the Uuid constructor is the Function prototype object
                _prototype = engine.Realm.Intrinsics.Function.PrototypeObject
            };

            obj.PrototypeObject = UuidPrototype.CreatePrototypeObject(engine, obj);

            // The initial value of Uuid.prototype is the Date prototype object
            obj.SetOwnProperty("prototype", new PropertyDescriptor(obj.PrototypeObject, false, false, false));

            engine.SetValue("Uuid", obj);
            obj.Configure();
            obj.PrototypeObject.Configure();

            return(obj);
        }