Skip to content

Commit 33b1814

Browse files
committed
Refine actor examples
1 parent 114a627 commit 33b1814

File tree

1 file changed

+12
-12
lines changed
  • daprdocs/content/en/js-sdk-docs/js-actors

1 file changed

+12
-12
lines changed

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

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ async function start() {
7474

7575
```javascript
7676
import { DaprServer, DaprClient } from "dapr-client";
77-
import DemoActor from "./actor/DemoActor";
77+
import StateActor from "./actor/StateActor";
7878

7979
const daprHost = "127.0.0.1";
8080
const daprPort = "50000"; // Dapr Sidecar Port of this Example Server
@@ -88,35 +88,35 @@ async function start() {
8888

8989
// Creating actor bindings
9090
await server.actor.init();
91-
server.actor.registerActor(DemoActor);
91+
server.actor.registerActor(StateActor);
9292
await server.startServer();
9393

9494
const actorId = "actor-id";
9595

96-
await client.actor.stateTransaction("DemoActor", actorId, [
96+
await client.actor.stateTransaction("StateActor", actorId, [
9797
{
9898
operation: "upsert",
9999
request: {
100-
key: "key-1",
101-
value: "my-new-data-1"
100+
key: "first-key",
101+
value: "hello"
102102
}
103103
},
104104
{
105105
operation: "upsert",
106106
request: {
107-
key: "key-to-delete",
108-
value: "my-new-data-1"
107+
key: "second-key",
108+
value: "world"
109109
}
110110
},
111111
{
112112
operation: "delete",
113113
request: {
114-
key: "key-to-delete"
114+
key: "second-key"
115115
}
116116
}
117117
]);
118118

119-
const ActorStateGet = await client.actor.stateGet("DemoActor", actorId, "key-to-delete");
119+
const ActorStateGet = await client.actor.stateGet("StateActor", actorId, "first-key");
120120
}
121121
```
122122

@@ -160,7 +160,7 @@ async function start() {
160160
period: Temporal.Duration.from({ seconds: 1 })
161161
});
162162

163-
// Stop the timer
163+
// Delete the timer
164164
await client.actor.timerDelete(ActorTimerImpl.name, actorId, timerId);
165165
}
166166
```
@@ -186,7 +186,7 @@ async function start() {
186186
await server.startServer();
187187

188188
const actorId = "actor-id";
189-
const timerId = "actor-timer-id";
189+
const reminderId = "actor-timer-id";
190190

191191
// Activate our actor
192192
await client.actor.invoke("PUT", ActorReminderImpl.name, actorId, "init");
@@ -198,7 +198,7 @@ async function start() {
198198
data: 100
199199
});
200200

201-
const res0 = await client.actor.invoke("PUT", ActorReminderImpl.name, actorId, "getCounter");
201+
// Delete the reminder
202202
await client.actor.reminderDelete(ActorReminderImpl.name, actorId, reminderId);
203203
```
204204

0 commit comments

Comments
 (0)