Updating the example for addOnUnload to AMD syntax.

Refs #17468.