SOURCE

// /*
//  *  Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
//  *
//  *  Use of this source code is governed by a BSD-style license
//  *  that can be found in the LICENSE file in the root of the source
//  *  tree.
//  */

// 'use strict';

// class Prop {
//     constructor(setter, defaultValue) {
//         this.setter = setter;
//         this.value = defaultValue;
//     }

//     type() {
//         return typeof this.value;
//     }

//     setter() {
//         return this.setter;
//     }
// }

// class Base {
//     constructor() {
//         this.mProps = {};
//     }

//     addProp(key, value) {
//         this.mProps[key] = value;
//     }

//     applayParams(parmas) {
//         for (let [key, value] of Object.entries(this.mProps)) {
//             if (!parmas[key])
//                 continue;

//             this[value](parmas[key]);
//             console.log(`key: ${key}, value: ${parmas[key]}`);
//         }
//     }
// };

// class Child extends Base {
//     constructor(parmas) {
//         super();

//         this.a = -1;
//         this.peer = {"b": -1};

//         this.addProp("a", "setA");
//         // this.addProp("b", new Prop(this.setB, -1));

//         this.applayParams(parmas);
//     }

//     setA(value) {
//         this.a = value;
//     }

//     setB(value) {
//         this.peer["b"] = value;
//     }

//     printProp() {
//         console.log(this["a"]);
//         console.log(this.peer["b"]);
//     }
// }

// let child = new Child({"a": 1, "b": 2, "d": 4});
// child.printProp();

// let globalCertificate = NaN;
// class TEST1 {
//     constructor() {
//         if (!globalCertificate) {
//             RTCPeerConnection.generateCertificate({
//                 name: "ECDSA", namedCurve: "P-256"
//             }).then(function (certificate) {
//                 console.info(certificate.getFingerprints());
//                 globalCertificate = certificate;
//             }).catch(console.error);
//         }

//         // setTimeout(alert("mod"), 3000);
//     }
// }

// // setTimeout(alert("mod"), 3000);

// let test1 = new TEST1();


// Promise.reject(new Error("Promise Failed!")).catch(
//     err => alert('caught'));

// // 不会运行:error 已经被处理
// window.addEventListener('unhandledrejection', event => alert(event.reason));
// let header = new Headers({
//     "Accept": "*/*",
//     "Content-Type": "application/x-www-form-urlencoded",
//     "mode": "cros" 
// });

// fetch("https://120.92.155.20:9005/yunchang/getpeerinfo?device_id=311529312&local_ip=357b194d-de48-42dd-ac55-2cb5a5299417.local&reflex_ip=27.115.6.208&webrtc_local_port=64582&webrtc_reflex_port=51261&webrtc_fingerprint=a%3dfingerprint%3asha-256%20B9%3a66%3a6E%3a8C%3a03%3a25%3a69%3aB3%3aDD%3a2B%3a00%3a9F%3aCB%3a8F%3a22%3a8E%3aCF%3a17%3a50%3a14%3a42%3a75%3a07%3aC8%3a00%3a4C%3a9A%3a83%3a0F%3a6C%3a5B%3aC8&resource_id=450158832-1-31090.m4s&resource_type=3&resource_bitrate=1000000&segment_id=0&p2p_play_type=1&resource_url=https%3a%2f%2fupos-sz-mirrorcosdisp.bilivideo.com%2fupgcxcode%2f32%2f88%2f450158832%2f450158832-1-31090.m4s%3fe%3dig8euxZM2rNcNbdlhoNvNC8BqJIzNbfqXBvEuENvNC8aNEVEtEvE9IMvXBvE2ENvNCImNEVE%20%20%20%20%20Ij0Y2J_aug859r1qXg8gNEVE5XREto8z5JZC2X2gkX5L5F1eTX1jkXlsTXHeux_f2o859IB_%26uipk%3d5%26nbs%3d1%26deadline%3d1638190578%26gen%3dplayurlv2%26os%3dcosdispbv%26oi%3d3565259582%26trid%3d8aaf8cdd379543b2b9dbb9b8acaff45ez%26platform%3dpbox%26upsig%3d68d546801b569426c53fca073dd0db8e%26uparams%3de%2cuipk%2cnbs%2cdeadlin%20%20%20%20%20e%2cgen%2cos%2coi%2ctrid%2cplatform%26mid%3d0%26bvc%3dvod%26nettype%3d0%26orderid%3d0%2c3%26agrr%3d1%26logo%3d80000000%26from%3dpbox", 
// {method:"POST", headers: header}).then((response) => {
//     console.log(response.status);
// }).catch(alert);


/** */
function timeout() {
    let promise = Promise.resolve();
    promise.then(() => console.log("promise done!"));
}

setTimeout(timeout, 0);

setTimeout(console.log("code finished"), 0);; // 这个 alert 先显示
console 命令行工具 X clear

                    
>
console