A fulfilled state marks the successful completion of an asynchronous computation, with its final value available. For a long-running operation, reaching this state means determining when the operation is done and retrieving its result. section 10.3.3
Use one of two common ways to determine whether an operation has fulfilled:
- Poll the operation with GetOperation until its done field becomes true, then return the result. This is straightforward but can generate repeated requests and unnecessary network and server work. section 10.3.3
- Call a custom WaitOperation method that waits for completion before returning the final result, reducing client-side polling logic. section 10.3.3
Listing 10.5 Polling for updates about an LRO until it’s done
async function createChatRoomAndWait(): Promise<ChatRoom> {
let operation: Operation<ChatRoom, CreateChatRoomMetadata>;
operation = CreateChatRoom({ #1
resource: { title: "Cool Chat" }
});
while (!operation.done) { #2
operation = GetOperation<ChatRoom,
CreateChatRoomMetadata>({ #3
id: operation.id
});
await new Promise( (resolve) => { #4
setTimeout(resolve, 1000)
});
}
return operation.result as ChatRoom; #5
}
The listings show a CreateChatRoom operation being resolved through polling, a standard GetOperation method, or a custom WaitOperation method. section 10.3.3

