window = global;
createPrototype = function (name, obj) {
    Object.assign(obj, {
        constructor: function (){},
        // name: name,
        prototype: {
            get function(){

            },
            toString: function () {
                return `'function ${name}() { [native code] }'`
                // throw new TypeError('Illegal invocation')
            }
        },
        toString: function () {
            return `'function ${name}() { [native code] }'`
        }
    })
    // Object.defineProperty(obj.prototype, {
    //     [Symbol.toStringTag]: {value:name,writable:false,enumerable:false,configurable:true},
    //     prototype: {
    //         toString: function (){
    //             return `'function ${name}() { [native code] }'`
    //             // throw new TypeError('Illegal invocation')
    //         }
    //     },
    // })
    return obj

}
window.CustomEvent = createPrototype('CustomEvent', {
    initCustomEvent: function (){
        debugger
    }
})
Object.defineProperties(window.CustomEvent, {
    detail: {
    },
    constructor: {
        value: function () {},
        writable: true, enumerable: false, configurable: true
    },
    [Symbol.iterator]: {
        value: function (){}
    },
    [Symbol.toStringTag]: {
        value:function () {

        }
    }
})
Object.defineProperties(window.CustomEvent.prototype, {
    detail: {
        get :function (){},
        set :function (){},
        enumerable: true, configurable: true,
    },
    constructor: {
        value: function () {},
        writable: true, enumerable: false, configurable: true
    },
    [Symbol.iterator]: {
        value: function (){}
    },
    [Symbol.toStringTag]: {
        value:function () {

        }
    }
})

var v_saf;!function(){var n=Function.toString,t=[],i=[],o=[].indexOf.bind(t),e=[].push.bind(t),r=[].push.bind(i);function u(n,t){return-1==o(n)&&(e(n),r(`function ${t||n.name||""}() { [native code] }`)),n}Object.defineProperty(Function.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"function"==typeof this&&i[o(this)]||n.call(this)}}),u(Function.prototype.toString,"toString"),v_saf=u}();
function _inherits(t, e) {
    t.prototype = Object.create(e.prototype, {
        constructor: { value: t, writable: true, configurable: true }
    }), e && Object.setPrototypeOf(t, e) }
// Object.defineProperty(Object.prototype, Symbol.toStringTag, {
//     get() { return Object.getPrototypeOf(this).constructor.name }
// });
// Object.defineProperty(window.CustomEvent.prototype.detail, 'get', {
//     value: function(){}
// })
EventTarget = v_saf(function EventTarget(){;})

Screen = v_saf(function Screen(){if (!v_new_toggle){ throw TypeError("Illegal constructor") };}); _inherits(Screen, EventTarget)
Object.defineProperties(Screen.prototype, {
    availWidth: {  enumerable: true, configurable: true},
    availHeight: {  enumerable: true, configurable: true},
    width: {set:undefined,get:function width() { throw TypeError("legal invocation")},  enumerable: true, configurable: true},
    height: {  enumerable: true, configurable: true},
    colorDepth: {  enumerable: true, configurable: true},
    pixelDepth: {  enumerable: true, configurable: true},
    availLeft: {  enumerable: true, configurable: true},
    availTop: {  enumerable: true, configurable: true},
    orientation: {  enumerable: true, configurable: true},
    onchange: {  enumerable: true, configurable: true},
    isExtended: {  enumerable: true, configurable: true},
    [Symbol.toStringTag]: {value:"Screen",writable:false,enumerable:false,configurable:true},
})
// Object.defineProperty(Screen.prototype, 'width', {
//     value: function (){
//         throw TypeError("Illegal constructor")
//     },
//     set:undefined,get:function () {},  enumerable: true, configurable: true
// })
console.log(Screen.prototype.width)
console.log(Object.getOwnPropertyDescriptor(Screen.prototype, 'width'))