There is a wgCurRevisionId field currently, which as noted on the doc page is, "The top revision ID of the currently viewed page at the time the page was served"
This is implemented with OutputPage->getWikiPage()->getLatest() (page_latest).
However, in some cases, it is necessary to have the effective revision id. For a simple historical version (oldid=123), this would be the displayed version. For a diff (oldid=123&diff=next, oldid=123&diff=987, etc.), if would be the revision denoted by the diff. This should be available as wgRevisionId.
This will allow JavaScript to look things up by the actual revision ID, or log it when necessary.
Version: 1.22.0
Severity: enhancement
See Also:
https://bugzilla.wikimedia.org/show_bug.cgi?id=60548