0

I was doing some testing on an app, and I realized that calling .state() on a Deferred object seem to launch .done() callback again and again.

I produce a reduced test case here

http://jsfiddle.net/vaxilart/ajeGm/

I was wondering if this is a normal behavior or if I misunderstand something.

Thank you in advance !

Simon Boudrias
  • 42,953
  • 16
  • 99
  • 134

1 Answers1

1

You're jsfiddle is not demonstrating what you want it to. Instead of re-executing the anonymous IIFE, you're re-executing all of the code in global scope including the resolve() over and over again. I think the modified version of the fiddle illustrates that calling .state() does nothing but returns the state.

http://jsfiddle.net/ajeGm/4/

Adam Jenkins
  • 51,445
  • 11
  • 72
  • 100
  • Hey thanks, you're right, I should've been calling arguments.callee instead of callee.caller... I couldn't get my head out of it. Thanks again – Simon Boudrias Apr 26 '12 at 19:09