locked
Cancelling a Promise and interacting with native components

    Question

  • Suppose I have some CPU-intensive functionality which, for the sake of gaining some speed, is wrapped in a native component.

    Calling this function is then done in a Promise on the JavaScript side which will return as soon as the native component call completes.

    Now the application receives an "unload" event and wants to a) stop the native component and b) save its database.

    At the moment we don't know how to react on the cancellation from inside the Promise and - as the native component is still running - it takes a lot of CPU that prevents the database save from completing before the application gets terminated by the system.

    Thursday, March 22, 2012 4:47 PM

Answers