Skip to content

feat(core): add Promise/async-await support #45

@usernane

Description

@usernane

Problem

The library currently only supports callbacks, which feels dated in modern JavaScript development.

Suggestion

  • Make send() return a Promise
  • Allow await ajax.send() syntax
  • Maintain backward compatibility with existing callback system

Example API

// New Promise-based usage
const response = await ajax.send();
console.log(response.jsonResponse);

// Or with .then()
ajax.send().then(response => {
  console.log(response.jsonResponse);
}).catch(err => {
  console.error(err);
});

Benefits

  • Aligns with modern JS patterns
  • Enables cleaner async/await code
  • Better error handling with try/catch

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions