3 ms·
The spec doc sort of mentions it: http://www.ecma-international.org/ecma-262/6.0/#sec-jobs-and-job-queues http://www.ecma-international.org/ecma-262/6.0/#sec-jo
by bzbarsky 11y ago
The spec doc sort of mentions it: http://www.ecma-international.org/ecma-262/6.0/#sec-jobs-and-job-queues http://www.ecma-international.org/ecma-262/6.0/#sec-jobs-and... and when you initially start up your environment you do http://www.ecma-international.org/ecma-262/6.0/#sec-ecmascript-initialization http://www.ecma-international.org/ecma-262/6.0/#sec-ecmascri... which ends with a NextJob call. So you have to go do a Job. There are various sorts of Jobs, but all of them end their processing steps with a NextJob call.
I guess the only issue is that what happens if you have unresolved promises when your Job queues go empty is implementation-defined, because an implementation is allowed to terminate when there are no Jobs. But if it doesn't terminate, resolving the Promise will enqueue a PromiseReactionJob. And I guess not actually call NextJob; that part is up to the implementation.