A NativeScript module for simply handling background tasks via web workers.
- NativeScript 2.4+ (s. Multithreading Model)
tns plugin add nativescript-tasks
inside your app project to install the module.
;Tasks.startNew,5979 // 5979 will be stored in 'state'// property of 'ctx'.then.catch;
- You can only submit and return serializable objects and values!
- All task functions are 'closures', what means that you CANNOT access variables or modules outside such functions. All functions are serialized as strings and submitted to the worker script where "external stuff" is NOT available! The only way to share data with the functions is to submit an optional and serializable "state value".
Read the official documentation to get more information.