WorkerLocation:port 属性
        
        
          
                Baseline
                
                  Widely available
                
                
              
        
        
        
          
                
              
                
              
                
              
        
        
      
      This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2015年7月.
备注: 此特性仅在 Web Worker 中可用。
WorkerLocation 对象的 port 属性返回该 Worker 所处位置的 port 部分。
值
字符串。
示例
js
// 在位于页面 http://localhost:8080/ 上的 Web Worker 中
const result = location.port; // 返回“8080”
规范
| Specification | 
|---|
| HTML> # dom-workerlocation-port> | 
浏览器兼容性
Loading…
参见
- 它所属的 WorkerLocation接口。