File tree Expand file tree Collapse file tree 1 file changed +8
-9
lines changed Expand file tree Collapse file tree 1 file changed +8
-9
lines changed Original file line number Diff line number Diff line change 1+ use  js_sys:: Function ; 
12use  serde:: Serialize ; 
3+ use  std:: cell:: RefCell ; 
4+ use  std:: rc:: Rc ; 
25use  wasm_bindgen:: { 
36    prelude:: { wasm_bindgen,  JsError } , 
4-     JsValue , 
5-     JsCast , 
7+     JsCast ,  JsValue , 
68} ; 
7- use  js_sys:: Function ; 
8- use  std:: cell:: RefCell ; 
9- use  std:: rc:: Rc ; 
109
1110use  ironcalc_base:: { 
1211    expressions:: { lexer:: util:: get_tokens as  tokenizer,  types:: Area ,  utils:: number_to_column} , 
@@ -99,11 +98,11 @@ impl Model {
9998                } 
10099            } 
101100        } ) ; 
102-          
101+ 
103102        // Store subscription in an Rc<RefCell<>> so it can be moved into the closure 
104103        let  subscription_rc = Rc :: new ( RefCell :: new ( Some ( subscription) ) ) ; 
105104        let  subscription_clone = subscription_rc. clone ( ) ; 
106-          
105+ 
107106        // Create the unsubscribe function 
108107        let  unsubscribe_fn = wasm_bindgen:: closure:: Closure :: wrap ( Box :: new ( move  || { 
109108            if  let  Ok ( mut  sub)  = subscription_clone. try_borrow_mut ( )  { 
@@ -112,10 +111,10 @@ impl Model {
112111                } 
113112            } 
114113        } )  as  Box < dyn  FnMut ( ) > ) ; 
115-          
114+ 
116115        let  js_function = unsubscribe_fn. as_ref ( ) . unchecked_ref :: < Function > ( ) . clone ( ) ; 
117116        unsubscribe_fn. forget ( ) ;  // Prevent the closure from being dropped 
118-          
117+ 
119118        js_function
120119    } 
121120
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments