Class: BasicObject
  
  
  
  
  
  
  
  
  
  
  
  
    - Defined in:
- opal/stdlib/await.rb
 
  
    
      Instance Method Summary
      collapse
    
    
  
  
    Instance Method Details
    
      
  
  
    #instance_exec_await(*args, &block)  ⇒ Object 
  
  
  
  
    | 
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112 | # File 'opal/stdlib/await.rb', line 81
def instance_exec_await(*args, &block)
  ::Kernel.raise ::ArgumentError, 'no block given' unless block
        nil.__await__
  %x{
    var block_self = block.$$s,
        result;
    block.$$s = null;
    if (self.$$is_a_module) {
      self.$$eval = true;
      try {
        result = await block.apply(self, args);
      }
      finally {
        self.$$eval = false;
      }
    }
    else {
      result = await block.apply(self, args);
    }
    block.$$s = block_self;
    return result;
  }
end |