Fix cordova reference

Currently the directive will fail `onClose` if the global `cordova` is undefined (in the browser). Here, I replaced the `!cordova` check with a proper `typeof cordova === 'undefined'`