Skip to content

Commit f544d8e

Browse files
committed
Fix nits
Signed-off-by: Shubham Sharma <[email protected]>
1 parent ac72421 commit f544d8e

File tree

2 files changed

+8
-7
lines changed
  • daprdocs/content/en/js-sdk-docs/js-actors
  • examples/http/actor-parking-sensor

2 files changed

+8
-7
lines changed

daprdocs/content/en/js-sdk-docs/js-actors/_index.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ export default class ParkingSensorImpl extends AbstractActor implements ParkingS
6868
Initialize and register your actors by using the `DaprServer` package:
6969

7070
```javascript
71-
import { DaprServer } from "dapr-server";
71+
import { DaprServer } from "dapr-client";
7272
import ParkingSensorImpl from "./ParkingSensorImpl";
7373

7474
const daprHost = "127.0.0.1";
@@ -88,19 +88,20 @@ console.log(`Registered Actors: ${JSON.stringify(resRegisteredActors)}`);
8888
```
8989

9090
## Invoking Actor Methods
91-
After Actors are registered, use the `DaprClient` to invoke methods on an actor. The client will call the actor methods defined in the actor interface.
91+
After Actors are registered, create a Proxy object that implements `ParkingSensorInterface` using the `ActorProxyBuilder`. You can invoke the actor methods by directly calling methods on the Proxy object. Internally, it translates to making a network call to the Actor API and fetches the result back.
9292

9393
```javascript
9494
import { DaprClient, ActorId } from "dapr-client";
9595
import ParkingSensorImpl from "./ParkingSensorImpl";
96+
import ParkingSensorInterface from "./ParkingSensorInterface";
9697

9798
const daprHost = "127.0.0.1";
9899
const daprPort = "50000";
99100

100101
const client = new DaprClient(daprHost, daprPort);
101102

102103
// Create a new actor builder. It can be used to create multiple actors of a type.
103-
const builder = new ActorProxyBuilder<ActorSayInterface>(ActorSayImpl, client);
104+
const builder = new ActorProxyBuilder<ParkingSensorInterface>(ActorSayImpl, client);
104105

105106
// Create a new actor instance.
106107
const actor = builder.build(new ActorId("my-actor"));
@@ -125,7 +126,7 @@ await actor.getStateManager().setState(PARKING_SENSOR_PARKED_STATE_NAME, true);
125126

126127
// GET state
127128
const value = await actor.getStateManager().getState(PARKING_SENSOR_PARKED_STATE_NAME);
128-
if (value !== null) {
129+
if (!value) {
129130
console.log(`Received: ${value}!`);
130131
}
131132

examples/http/actor-parking-sensor/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ npm run start:dapr
2626

2727
## Visualize
2828

29-
Start grafana on localhost:3001 and use `admin`/`password` to login and visualize the dashboard!
29+
Start Grafana on [localhost:3001](localhost:3001) and use the credentials `admin`:`password` to login and visualize the dashboard!
3030

31-
Sample:
32-
![output.png](./output.png "Sample output")
31+
Sample output:
32+
![Sample Output](./output.png)
3333

3434
## References
3535
1. Original blog post: https://xaviergeerinck.com/post/2021/10/09/parking-garage

0 commit comments

Comments
 (0)