You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
| uri |`string`||✓| Uri to the manifest of a podlet |
1711
-
| name |`string`||✓| Name of the component. This is used to reference the component in your application, and does not have to match the name of the component itself |
1712
-
| retries |`number`|`4`|| The number of times the client should retry to settle a version number conflict before terminating. Overrides the `retries` option in the layout constructor |
1713
-
| timeout |`number`|`1000`|| Defines how long, in milliseconds, a request should wait before the connection is terminated. Overrides the `timeout` option in the layout constructor |
1714
-
| throwable |`boolean`|`false`|| Defines whether an error should be thrown if a failure occurs during the process of fetching a podlet. [See handling podlet unavailability](../layout/unavailable_podlets.md).|
1715
-
| resolveJs |`boolean`|`false`|| Defines whether to resolve relative URIs to absolute URIs for JavaScript assets |
1716
-
| resolveCss |`boolean`|`false`|| Defines whether to resolve relative URIs to absolute URIs for CSS assets |
| uri |`string`||✓| Uri to the manifest of a podlet |
1711
+
| name |`string`||✓| Name of the component. This is used to reference the component in your application, and does not have to match the name of the component itself |
1712
+
| retries |`number`|`4`|| The number of times the client should retry to settle a version number conflict before terminating. Overrides the `retries` option in the layout constructor |
1713
+
| timeout |`number`|`1000`|| Defines how long, in milliseconds, a request should wait before the connection is terminated. Overrides the `timeout` option in the layout constructor |
1714
+
| throwable |`boolean`|`false`|| Defines whether an error should be thrown if a failure occurs during the process of fetching a podlet. [See Fallbacks](/docs/guides/fallbacks). |
1715
+
| resolveJs |`boolean`|`false`|| Defines whether to resolve relative URIs to absolute URIs for JavaScript assets |
1716
+
| resolveCss |`boolean`|`false`|| Defines whether to resolve relative URIs to absolute URIs for CSS assets |
Copy file name to clipboardExpand all lines: docs/api/podlet.md
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -1711,7 +1711,7 @@ The prefix will be ignored if value is an absolute URL.
1711
1711
1712
1712
Method for defining proxy targets to be mounted in a layout server. For a
1713
1713
detailed overview of how proxying works, please see the
1714
-
[proxying guide](podlet/proxying.md) for further details.
1714
+
[proxying guide](/docs/guides/proxying) for further details.
1715
1715
1716
1716
When a podlet is put in development mode (`development` is set to `true` in the constructor) these proxy endpoints will also be mounted in the podlet for ease of development and you will then have the same proxy endpoints available in development as you do when working with a layout.
Copy file name to clipboardExpand all lines: docs/guides/assets.md
-4Lines changed: 0 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -124,7 +124,3 @@ Using the [shadow DOM](https://developer.mozilla.org/en-US/docs/Web/API/Web_comp
124
124
With `podlet.css()` the end result is a `<link />` tag in the HTML document's `<head />`. If your podlet's content renders inside a shadow DOM that CSS won't be able to reach the podlet.
125
125
126
126
With a declarative shadow DOM you have to include your own `<link />` to the CSS from inside the shadow DOM.
127
-
128
-
## Next steps
129
-
130
-
Next you might want to familiarise yourself with the Podium context.
Copy file name to clipboardExpand all lines: docs/guides/client-side-communication.md
+1-2Lines changed: 1 addition & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,5 @@
1
1
---
2
-
id: podlet_to_podlet_communication
3
-
title: Podlet to podlet communication in the browser
2
+
title: Client-side communication in a Podium app
4
3
---
5
4
6
5
Podium provides a client side library called [@podium/browser] that includes a [MessageBus](/docs/api/browser#messagebus). The message bus simplifies passing data between different podlets' client-side JavaScript.
Copy file name to clipboardExpand all lines: docs/guides/fallbacks.md
+34-2Lines changed: 34 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -3,15 +3,15 @@ id: fallbacks
3
3
title: Fallbacks
4
4
---
5
5
6
-
What happens if a podlet server is down? Unresponsive? Responding too slowly? By default Podium will simply render an empty string in its place. You might, however, want to have some measure of control over what gets shown. Enter fallbacks.
6
+
What happens to a layout if a podlet is down, unresponsive, or slow? By default the layout will render an empty string in its place. However, you might want to have control what gets shown, such as a simplified static version of a complex dynamic podlet. Fallbacks let you do this.
7
7
8
8
## How do fallbacks work?
9
9
10
10
On the first request to a podlet a layout will read the podlet’s [manifest](/docs/api/manifest). The manifest includes the location of the fallback. The layout then makes a request to the fallback route and caches the response.
11
11
12
12
Later, if the podlet server cannot be reached for any reason, or the request returns a non 200 response, the layout will use the podlet’s cached fallback content instead.
13
13
14
-
Note that the podlet’s assets will still be served, so the fallback can depend on both JS and CSS being present once it’s rendered. This assumes the assets are hosted on a server [separate from the podlet](/docs/introduction/assets#use-a-cdn).
14
+
Note that the podlet’s assets will still be served, so the fallback can depend on both JS and CSS being present once it’s rendered. This assumes the assets are hosted on a server [separate from the podlet](/docs/guides/assets#use-a-cdn).
15
15
16
16
## Defining a fallback route
17
17
@@ -55,3 +55,35 @@ const podlet = new Podlet(/*...*/);
By default a layout will substitute a fallback (or empty string) for a podlet's content whenever the podlet either fails to respond with a 2xx status code or the podlet fails to respond within 1000 milliseconds.
62
+
63
+
In some cases it may make no sense to show a page at all if some of its content is not available. You may prefer to show an error page rather than fallback content or an empty string. This is especially true for dynamic content that is the main focus of a page. If all you can show is a header and footer, it might be better to show an error page explaining the situation to the user.
64
+
65
+
In order to facilitate this, it is possible to set a podlet as `throwable` when it is registered.
66
+
67
+
```js
68
+
constgettingStarted=layout.client.register({
69
+
throwable:true,
70
+
});
71
+
```
72
+
73
+
When the layout fetch the podlet, if that podlet is not available, then the fetch will reject with an error that you can then handle as you see fit.
74
+
75
+
Error objects are instances of [Boom](https://www.npmjs.com/package/@hapi/boom) errors and are decorated with the HTTP status code from the podlet response.
0 commit comments