当前位置:网站首页>ArcGIS JS map internal and external network environment judgment
ArcGIS JS map internal and external network environment judgment
2022-07-28 07:36:00 【No overrun】
In order to read intranet server resources in Intranet environment , Read the content of the simplified version under the external network environment .
Plan to access the intranet interface , If the return is successful , It means the Intranet environment ; If no content is returned , The Internet .
The map library has passed TypeScript build , More complicated , A lot of code .
Scheme 1
adopt dojo.xhr modular , Request test interface , And set the parameter to {sync:true,timeout:200}
Because the existing map library is a synchronous structure , therefore , Use sync request here , And set the timeout to 200, stay 200ms after , After determining the internal and external network environment, execute the subsequent code .
Found after testing , Functional implementation requirements . In effect ,timeout Invalid parameter , The request is generally stuck 21 About seconds , To judge the internal and external network environment .
Inquire about dojo Official information , When synchronizing a request ,timeout Invalid parameter .
20 The delay of many seconds is unacceptable , It doesn't work . We can only change the scheme
Option two
Use the asynchronous request scheme
Found by test ,xhr When asked , It can be quickly judged that it is the intranet and Internet environment , So I decided to adopt an asynchronous method .
Since most of the existing code structures are written synchronously , When using asynchrony , There may be unfinished judgment of internal and external network environment , When the map initialization is not completed , The subsequent related code base has started to execute , Lead to many unknown undefined The problem of not getting objects like .
Finally, through customization Accessor class , Use watchUtils.whenTrue() Method , To solve the problem .
Reference post
Searched a lot of information , The front end did not find a suitable method to detect the internal and external networks . If there is a better solution , Welcome to share
边栏推荐
- Why is ESD protection so important for integrated circuits? How to protect?
- User mode vs kernel mode, process vs thread
- Introduction to magnetic ring selection and EMC rectification skills
- guava之EventBus
- Method of hiding scroll bar in wechat applet
- “核弹级” Log4j 漏洞仍普遍存在,并造成持续影响
- Mysql查看某个表所占内存大小
- ESD静电不用怕,本文告诉你一些解决方法
- 5G 商用第三年:无人驾驶的“上山”与“下海”
- EMC中的基石-电磁兼容滤波知识大全!
猜你喜欢

EMC's "don't come back until you rectify"

Deeply analyze the implementation of singleton mode

Redis的RDB持久化和AOF持久化的底层原理

Dynamic memory management knowledge points

收藏 | 结合个人经验,我总结了这7点EMC相关知识

ThreadLocal那些事

xmpp 服务研究(二) prosody 创建账户

Overview of distributed system development

EMC设计攻略 —时钟

cdn.jsdelivr.net不可用,该怎么办
随机推荐
细说共模干扰和差模干扰
[untitled]
CLion调试redis6源码
DNA修饰金属铑Rh纳米颗粒RhNPS-DNA(DNA修饰贵金属纳米颗粒)
Map uses tuple to realize multiple value values
DNA修饰贵金属纳米颗粒|DNA脱氧核糖核酸修饰金属钯Pd纳米颗粒PdNPS-DNA
Reasons why null is not recommended for MySQL fields
LeNet5、AlexNet、VGGNet、ResNet
Niuke MySQL - SQL must know and know
Overview of distributed system development
DNA-Ag2SQDs脱氧核糖核酸DNA修饰硫化银Ag2S量子点的合成方法
链表中倒数第k个节点——双指
【jvm优化超详细】常见的JVM调优场景
Soft exam certificate can be used like this! Get a certificate = get a professional title?
VCF file production
Mysql查看某个表所占内存大小
JS upload file method
The cornerstone of EMC - complete knowledge of electromagnetic compatibility filtering!
ESD静电不用怕,本文告诉你一些解决方法
干货|分享一个EMC实际案例及整改过程