How deffered object notifies its promise that it has been resolved?

I mean that if there is a way by which deffered object notifies its promise about state changes, therefore anyone can trigger callbacks attached to promise by the same way. I guess, that I'm missing something in my reasonings, but I can't figure out what exactly.

That is not meant to be any kind of real Deferred implementation, it just is meant to demonstrate how the deferred can access the promise without the promise being able to resolve the deferred.

You can view the full details of jQuery's Deferredin the source. But note that jQuery's Deferred is a bit outdated; these days, having two separate objects with names (Deferred vs. Promise) is out of fashion. Instead, the JavaScript Promise object accepts an initialization function, and the initialization function receives a resolver function it can use to resolve the promise.1

1There are still two objects involved: The promise and the execution context created by calling the initializer, but that's getting a bit technical...

Email codedump link for How deffered object notifies its promise that it has been resolved?