Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Pass methodName to Cordova Method #3557

Closed
1 of 3 tasks
EinfachHans opened this issue Oct 18, 2020 · 0 comments · Fixed by #3558
Closed
1 of 3 tasks

feat: Pass methodName to Cordova Method #3557

EinfachHans opened this issue Oct 18, 2020 · 0 comments · Fixed by #3558

Comments

@EinfachHans
Copy link
Contributor

EinfachHans commented Oct 18, 2020

I'm submitting a ... (check one with "x")

Current behavior:

Currently the created Provider uses the method of the written Method as Method-Name for the Cordova Plugin.

Expected behavior:

Would be great to pass the methodName via the CordovaOptions.

Why Hans, why?
Let me explain why i want this: Currently the Cordova HTTP Plugin changed their logic a bit to be able to abort outgoing HTTP Requests. Now the methods can return a request id. So if we would change the Plugin to work like this, the Method must be sync and callbacks must be given as Param. That's a huge effort for users who don't need it like this (btw. i personally like Promise-based Stuff way more). But not doing it is also not good, simple because this cool function is missing then.

So my Idea would be to clone all methods, for example a second method for:

@Cordova()
post(url: string, body: any, headers: any): Promise<HTTPResponse> {
  return;
}

would be

@Cordova({
  methodName: 'post',
  sync: true
})
postSync(url: string, body: any, headers: any,
       success: (result: HTTPResponse) => void, failure: (error: any) => void): string {
  return;
}

I already created a PR, because this is only a small change i think: #3558

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant