Skip to content

Commit 03863e5

Browse files
committed
Merge branch 'joshthoward/do-docs' of github.com:cloudflare/cloudflare-docs into joshthoward/do-docs
2 parents afb20a2 + 1913630 commit 03863e5

File tree

1 file changed

+4
-4
lines changed
  • src/content/docs/durable-objects/api

1 file changed

+4
-4
lines changed

src/content/docs/durable-objects/api/id.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { Tabs, TabItem } from "~/components";
1111

1212
The `DurableObjectId` interface refers to a new or existing Durable Object instance. This interface is most frequently used by [`DurableObjectNamespace::get`](/durable-objects/api/namespace/#get) to obtain a stub for submitting requests to a Durable Object instance.
1313

14-
Note that creating an ID for a Durable Object instance does not invoke the constructor of the Durable Object. This is done lazily when calling [`DurableObjectNamespace::get`](/durable-objects/api/namespace/#get) to create a [`DurableObjectStub`](/durable-objects/api/stub) from a `DurableObjectId`. This ensures that objects are not constructed unless their methods can be directly invoked.
14+
Note that creating an ID for a Durable Object instance does not create the Durable Object. The Durable Object is created lazily after calling [`DurableObjectNamespace::get`](/durable-objects/api/namespace/#get) to create a [`DurableObjectStub`](/durable-objects/api/stub) from a `DurableObjectId`. This ensures that objects are not constructed until they are actually accessed.
1515

1616
:::note[`DurableObjectId`]
1717

@@ -53,7 +53,7 @@ A 64 digit hex string.
5353
```js
5454
const id1 = env.MY_DURABLE_OBJECT.newUniqueId();
5555
const id2 = env.MY_DURABLE_OBJECT.newUniqueId();
56-
console.assert(!id1.equals(id2), "This should always be true");
56+
console.assert(!id1.equals(id2), "Different unique ids should never be equal.");
5757
```
5858

5959
#### Parameters
@@ -75,8 +75,8 @@ A boolean. True if equal and false otherwise.
7575
```js
7676
const id1 = env.MY_DURABLE_OBJECT.newUniqueId();
7777
const id2 = env.MY_DURABLE_OBJECT.idFromName("foo");
78-
console.assert(id1.name === undefined, "This should always be true");
79-
console.assert(id2.name === "foo", "This should always be true");
78+
console.assert(id1.name === undefined, "unique ids have no name");
79+
console.assert(id2.name === "foo", "name matches parameter to idFromName");
8080
```
8181

8282
## Related resources

0 commit comments

Comments
 (0)