Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 25 additions & 2 deletions docs/appregistry.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ To "stop" an application when a view should be destroyed, call `AppRegistry.unmo
* [`runApplication`](appregistry.md#runapplication)
* [`unmountApplicationComponentAtRootTag`](appregistry.md#unmountapplicationcomponentatroottag)
* [`registerHeadlessTask`](appregistry.md#registerheadlesstask)
* [`registerCancellableHeadlessTask`](appregistry.md#registercancellableheadlesstask)
* [`startHeadlessTask`](appregistry.md#startheadlesstask)
* [`cancelHeadlessTask`](appregistry.md#cancelheadlesstask)

---

Expand Down Expand Up @@ -151,13 +153,22 @@ static unmountApplicationComponentAtRootTag(rootTag)
### `registerHeadlessTask()`

```javascript
static registerHeadlessTask(taskKey, task)
static registerHeadlessTask(taskKey, taskProvider)
```

Register a headless task. A headless task is a bit of code that runs without a UI. @param taskKey the key associated with this task @param task a promise returning function that takes some data passed from the native side as the only argument; when the promise is resolved or rejected the native side is notified of this event and it may decide to destroy the JS context.
Register a headless task. A headless task is a bit of code that runs without a UI. @param taskKey the key associated with this task @param taskProvider a promise returning function that takes some data passed from the native side as the only argument; when the promise is resolved or rejected the native side is notified of this event and it may decide to destroy the JS context.

---

### `registerCancellableHeadlessTask()`

```javascript
static registerCancellableHeadlessTask(taskKey, taskProvider, taskCancelProvider)
```

Register a headless task which can be cancelled. A headless task is a bit of code that runs without a UI. @param taskKey the key associated with this task @param taskProvider a promise returning function that takes some data passed from the native side as the only argument; when the promise is resolved or rejected the native side is notified of this event and it may decide to destroy the JS context. @param taskCancelProvider a void returning function that takes no arguments; when a cancellation is requested, the function being executed by taskProvider should wrap up and return ASAP.
---

### `startHeadlessTask()`

```javascript
Expand All @@ -167,3 +178,15 @@ static startHeadlessTask(taskId, taskKey, data)
Only called from native code. Starts a headless task.

@param taskId the native id for this task instance to keep track of its execution @param taskKey the key for the task to start @param data the data to pass to the task

---

### `cancelHeadlessTask()`

```javascript
static cancelHeadlessTask(taskId, taskKey)
```

Only called from native code. Cancels a headless task.

@param taskId the native id for this task instance that was used when startHeadlessTask was called @param taskKey the key for the task that was used when startHeadlessTask was called