Replies: 2 comments 3 replies
-
In the mean time I got a lot further. See https://github.com/svdoever/FluidHelloWorld for an example implementation and some documentation on this. |
Beta Was this translation helpful? Give feedback.
-
@svdoever You made impressive progress! I noticed in an earlier iteration of your code that you were checking for initialization of an initial object: if (!container.initialObjects.diceSequence) {
log("Initial creation of dice sequence");
try {
container.initialObjects.diceSequence = SharedNumberSequence.create(
container.runtime,
"dice-sequence"
);
} catch (e) {
log(`Error creating dice sequence: ${e}`);
}
} You are correct that this code isn't correct or needed. Initial objects are always initialized and available to you as part of loading the container. So you can just access the
Correct! Also note that if you wanted to initialize some "default data" in an initial object, you can populate the data when the container is created, but before it is attached. There's more about this in the fluidframework.com docs. How was your experience working with Fluid overall? What was the most challenging? I'm excited that you're exploring the framework, so let me know how I can help! |
Beta Was this translation helpful? Give feedback.
-
For a project I would like to record a sequence of interactions for a certain user, but to understand the concept better I thought: let's take the FluidHelloWorld example (the dice rolling) and keep track of the sequence of dice values.
I would like to use the
SharedNumberSequence
, but there is not much documentation on its usage.First step seems to be to extend the container schema and the
initialObjects
:Next step seems to be to initialize the
diceValues
, don't know how bu after searching the source code something like the following seems to be what is needed:Is this correct? And what is the next step to add the initial "1" value to the
diceValues
? And how do I add the next value?I expected I need to use the
insert
operation, e.g.:I assume this because in the implementation in the
ShareSequence<T>
class I see:But is this the right approach?
Beta Was this translation helpful? Give feedback.
All reactions