Exemplo n.º 1
0
 private void ResolveOrReject(Reaction reaction)
 {
     if (reaction.Chain != null)
     {
         reaction.Chain.ResolveOrReject(new object[] { result }, state);
     }
     else if (reaction.Action != null && reaction.State == state)
     {
         reaction.Action(result);
     }
     else if (reaction.Callback == null || reaction.State != state)
     {
         // Do nothing.
     }
     else if (result == Undefined.Value)
     {
         reaction.Callback.Engine.AddPendingCallback(reaction.Callback, reaction.Callback.Engine.Global);
     }
     else
     {
         reaction.Callback.Engine.AddPendingCallback(reaction.Callback, reaction.Callback.Engine.Global, result);
     }
 }