Can the mechanism that loads the worker in Shared Web Workers be modified?

后端 未结 1 775
既然无缘
既然无缘 2020-12-02 01:10

Please see this related question for a background to this:

How can I load a shared web worker with a user-script?

With that question in mind, I want to explo

1条回答
  •  一整个雨季
    2020-12-02 02:03

    What are you trying to achieve using SharedWorker?

    to pass messages between pages from the same domain without having to set a constant interval to check if a local storage variable had changed.

    You can use storage event to communicate messages between tabs at same origin

    At index.html

    
    
    
      
      
    
      
        open b.html
        
        
        
        
    
    

    b.html

    
    
    
      
      
    
      
        
        
    
        
        
    
    

    plnkr http://plnkr.co/edit/4nR7Rpu4zXSgTR831vQW?p=preview

    0 讨论(0)
提交回复
热议问题