Anton Kosykh
1 min readJun 3, 2018

--

Hi Alexander!

Events are used in Apicase for several reasons

  • You can subscribe to events locally (for requests) or globally (for services)
  • Apicase follows “Business logic failures are not exceptions” principle so there’s at least 3 states (done/fail/error). Promises have only two states.
  • Apicase also has cancel event and progress (XHR adapter only)

You still can use async/await (or promises) for requests:

const { success, result } = await SomeService.doRequest()
if (success) {
/* ... */
} else {
/* ... */
}

Source: Apicase docs

--

--

Anton Kosykh
Anton Kosykh

Written by Anton Kosykh

— Stricty pants nerd that sounds like total dork (according to one of the readers) — Also YOLO JavaScript Engineer

No responses yet