
在所有情况下取到顶层对象
发布日期:2021-05-07 06:42:44
浏览次数:11
分类:原创文章
本文共 415 字,大约阅读时间需要 1 分钟。
方法一
(typeof window !=="undefeated" ? window : ( typeof process === "object"&& typeof require === "function"&& typeof global === "object" ) ?global :this )
方法二
var getGlobal = function (){ if(typeof self !=="undefeated"){ return self } if(typeof window !=="undefined"){ return window} if(typeof global !=="undefined"){ return global } throw new Error("unable to locate global object ")}
发表评论
最新留言
网站不错 人气很旺了 加油
[***.192.178.218]2025年03月16日 13时56分13秒
关于作者

喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!
推荐文章
基于CC2530的跑马灯实验
2019-03-04
17级软件技术二班刘鑫磊安卓学期总结
2019-03-04
配置Log4j详细版
2019-03-04
数据结构 第五章 二叉树-1
2019-03-04
[Easy] 58. Length of Last Word
2019-03-04
[Easy] 100. Same Tree
2019-03-04
[Easy] 136. Single Number
2019-03-04
旁路由Openwrt设置
2019-03-04
PVE+集客AC+K2T-AP
2019-03-04
Jetson AGX Xavier硬件自启动
2019-03-04
网页实时显示已经运行了多少天 html+js
2019-03-04
判断移动端(手机)还是客户端(电脑)打开网页并跳转不同页面(首页)
2019-03-04
10分钟实现个人博客布置说说留言功能,Artitalk.js插件使用
2019-03-04
眼睛跟随鼠标转动的小黄人 html+css+js
2019-03-04
canvas贪吃蛇效果 html+css+js
2019-03-04
跟随鼠标移动的星星✩直接在页面引用✧✧✧
2019-03-04
poj 3660 (floyd)
2019-03-04
8086汇编语言21键电子琴
2019-03-04
找密码
2019-03-04