From 55f98f82ed97576d2b3e55e19eb4ad879d8548f6 Mon Sep 17 00:00:00 2001 From: Chris Nelson Date: Sat, 13 Jan 2024 18:05:57 -0500 Subject: [PATCH] added example --- README.md | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 7c26951..dbebc54 100644 --- a/README.md +++ b/README.md @@ -101,7 +101,31 @@ This will let you avoid the template rendering in an unevaluated "raw" state bef ## Context -If you have multiple `` elements, you can have them share a `LiveState` instance using the [context protocol](https://github.com/webcomponents-cg/community-protocols/blob/main/proposals/context.md). To do so, use the `provide-context` attribute on an instance that specifies a `url` and `topic` attribute. This element will then register its LiveState instance using the value of this attribute, as well as setting a property of `window` (the value being used as the propery name). On another `` instance you can use the `consume-context` attribute with the same name passed in to the other instances `provide-context` attribute. For the consuming instance, there is no need to specify url and topic as it will not be used. See the test cases for an example. +If you have multiple `` elements, you can have them share a `LiveState` instance using the [context protocol](https://github.com/webcomponents-cg/community-protocols/blob/main/proposals/context.md). To do so, use the `provide-context` attribute on an instance that specifies a `url` and `topic` attribute. This element will then register its LiveState instance using the value of this attribute, as well as setting a property of `window` (the value being used as the propery name). On another `` instance you can use the `consume-context` attribute with the same name passed in to the other instances `provide-context` attribute. For the consuming instance, there is no need to specify url and topic as it will not be used. + +Example: + +```html + + + +
some fallback content
+
+ + +
{{todo}}
+
+ +``` ## Status