fuzhengwei / CodeGuide

:books: 本代码库是作者小傅哥多年从事一线互联网 Java 开发的学习历程技术汇总,旨在为大家提供一个清晰详细的学习教程,侧重点更倾向编写Java核心内容。如果本仓库能为您提供帮助,请给予支持(关注、点赞、分享)!
https://bugstack.cn
Apache License 2.0
11.18k stars 3.75k forks source link

浏览器指纹Promise同步返回 #302

Open fuzhengwei opened 2 years ago

fuzhengwei commented 2 years ago
<script>

util = {
    test: function(){
        return new Promise( resolve => {    
            new Fingerprint2().get(function(result, components){             
                let value = result.toUpperCase();
                let token = value.substring(value.length - 6).toUpperCase();

                resolve(token);
            });
        })
    },
    test02:async function(){
        const result = await util.test();
        alert(result);
        console.log(result);
    }
}

util.test02();
console.log('end');

//alert(tmMenu.token());
</script>
fuzhengwei commented 2 years ago
util.test02().then(function(t){
        console.info(t);
    })
fuzhengwei commented 2 years ago

https://dashboard.fingerprint.com/onboarding