Updating the example for addOnUnload to AMD syntax.

Refs #17468.

(cherry picked from commit 4639b70e478252f1b16f6101c6567de839e23bc2)