In order to avoid checking several times the condition we could do:

```js
if (typeof self.oncontactimported) {
   var contactSaved = function() {
      window.setTimeout(self.oncontactimported, 0);
      continueCb();
   }
} else {
   var contactSaved = continueCb;
}
```