projects/netgrif-components-core/src/lib/task-content/services/task-event.service.ts
Holds logic about the available operations on a Task object based on it's state.
Beware that it gets the Task from (@link TaskContentService) instance and thus the task might not be always initialized. If the task is not initialized this class cannot work properly.
Properties |
|
Methods |
|
Accessors |
constructor(_taskContentService: TaskContentService)
|
||||||
Parameters :
|
ngOnDestroy |
ngOnDestroy()
|
Completes the stream
Returns :
void
|
Public publishTaskEvent | ||||||||
publishTaskEvent(event: TaskEventNotification)
|
||||||||
Emits a new TaskEventNotification into the notifications stream
Parameters :
Returns :
void
|
Protected isTaskPresent |
isTaskPresent()
|
Inherited from
TaskHandlingService
|
Defined in
TaskHandlingService:42
|
Returns :
boolean
|
Protected isTaskRelevant | ||||||||
isTaskRelevant(requestedTaskId: string)
|
||||||||
Inherited from
TaskHandlingService
|
||||||||
Defined in
TaskHandlingService:56
|
||||||||
Checks whether the current state of the TaskContentService and optionally if the SelectedCaseService, is still relevant to the task that was requested. This method is useful if you use UnlimitedTaskContentService, or a similar implementation. It is possible for the currently "selected" task to change in-between a backend request was sent and the response was received. In that case the response is no longer relevant and should be discarded, otherwise an illegal task state could be achieved on frontend.
Parameters :
Returns :
boolean
|
Protected _taskEventNotifications$ |
Type : Subject<TaskEventNotification>
|
taskEventNotifications$ |
gettaskEventNotifications$()
|
Provides information about results of events executed on the managed Task
Returns :
Observable<TaskEventNotification>
|
import {Injectable, OnDestroy} from '@angular/core';
import {TaskContentService} from './task-content.service';
import {TaskHandlingService} from '../../task/services/task-handling-service';
import {Observable, Subject} from 'rxjs';
import {TaskEventNotification} from '../model/task-event-notification';
/**
* Holds logic about the available operations on a {@link Task} object based on it's state.
*
* Beware that it gets the Task from (@link TaskContentService) instance and thus the task might not be always initialized.
* If the task is not initialized this class cannot work properly.
*/
@Injectable()
export class TaskEventService extends TaskHandlingService implements OnDestroy {
protected _taskEventNotifications$: Subject<TaskEventNotification>;
constructor(_taskContentService: TaskContentService) {
super(_taskContentService);
this._taskEventNotifications$ = new Subject<TaskEventNotification>();
}
/**
* Completes the stream
*/
ngOnDestroy(): void {
this._taskEventNotifications$.complete();
}
/**
* Provides information about results of events executed on the managed {@link Task}
*/
public get taskEventNotifications$(): Observable<TaskEventNotification> {
return this._taskEventNotifications$.asObservable();
}
/**
* Emits a new {@link TaskEventNotification} into the notifications stream
* @param event the event information that will be pushed into the stream
*/
public publishTaskEvent(event: TaskEventNotification): void {
this._taskEventNotifications$.next(event);
}
}