Hey! Why not? :-) Maybe I am missing something but the old code:
Curtain.hide(function onhide() {
  // Please close me and display the number of friends updated
  notifyParent(numFriends);
});
was invoking the old notifyParent function, this is:
function notifyParent(numFriends) {
  parent.postMessage({
    type: 'window_close',
    data: '',
      message: cancelled ? '' : _('friendsUpdated', {
      numFriends: numFriends
    })
  }, targetApp);
}
which the new code just "mimics". That's where the 'targetApp' comes from.
Am I missing anything? :-)