# ResourceNotificationService

- Module: [Aspire.Hosting](/reference/api/typescript/aspire.hosting.md)
- Version: `13.2.0`
- Kind: `handle`
- Source: [GitHub](https://github.com/microsoft/aspire)

## Definition

```typescript
interface ResourceNotificationService extends IDisposable {
  publishResourceUpdate(
      resource: IResource,
      state?: string,
      stateStyle?: string): void;
  tryGetResourceState(resourceName: string): ResourceEventDto;
  waitForDependencies(resource: IResource): void;
  waitForResourceHealthy(resourceName: string): ResourceEventDto;
  waitForResourceState(
      resourceName: string,
      targetState?: string): void;
  waitForResourceStates(
      resourceName: string,
      targetStates: string[]): string;
}
```

## Methods

- [publishResourceUpdate](/reference/api/typescript/aspire.hosting/resourcenotificationservice/publishresourceupdate.md) -- `method` -- Publishes an update for a resource's state
    ```typescript
  publishResourceUpdate(resource: IResource, state?: string, stateStyle?: string): void
  ```
- [tryGetResourceState](/reference/api/typescript/aspire.hosting/resourcenotificationservice/trygetresourcestate.md) -- `method` -- Tries to get the current state of a resource
    ```typescript
  tryGetResourceState(resourceName: string): ResourceEventDto
  ```
- [waitForDependencies](/reference/api/typescript/aspire.hosting/resourcenotificationservice/waitfordependencies.md) -- `method` -- Waits for all dependencies of a resource to be ready
    ```typescript
  waitForDependencies(resource: IResource): void
  ```
- [waitForResourceHealthy](/reference/api/typescript/aspire.hosting/resourcenotificationservice/waitforresourcehealthy.md) -- `method` -- Waits for a resource to become healthy
    ```typescript
  waitForResourceHealthy(resourceName: string): ResourceEventDto
  ```
- [waitForResourceState](/reference/api/typescript/aspire.hosting/resourcenotificationservice/waitforresourcestate.md) -- `method` -- Waits for a resource to reach a specified state
    ```typescript
  waitForResourceState(resourceName: string, targetState?: string): void
  ```
- [waitForResourceStates](/reference/api/typescript/aspire.hosting/resourcenotificationservice/waitforresourcestates.md) -- `method` -- Waits for a resource to reach one of the specified states
    ```typescript
  waitForResourceStates(resourceName: string, targetStates: string[]): string
  ```
