zotero/translators — comment on commit 99b225e38b10329ee94fb43d5be65ff06f40d41f
File: Optical Society of America.js line 80
By ajlyon:

@adam3smith: Note that the callback syntax for Z.selectItems(..) is not just for show-- it is because the connectors resume execution of the translator by calling the callback. That means that execution will not continue after the selectItems(..) call, but rather with whatever is specified in the callback. The callback has to contain all of the logic that follows the user selecting the desired items-- thus we often factor out the first callback to processDocuments into a separate, named function, so that we can just put processDocuments calls into the main code, without repeating the scrape code.

If my changes here don't make sense, let me know.