Lib: add unload event.
Merge pull request #189 from dbuenzli/unload

Lib: add unload event.