Adapting a Cordova Plugin patterns