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
Copy file name to clipboardExpand all lines: README.md
+42-1Lines changed: 42 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -36,6 +36,10 @@ let app = new FastBoot({
36
36
// additional global properties to define within the sandbox
37
37
});
38
38
},
39
+
40
+
// optional number to be provided when using `buildSandboxPerVisit` which defines the queue size for sandboxes.
41
+
// This number should represent your QPS of your service
42
+
maxSandboxQueueSize:<Number>// defaults to 1 if not provided
39
43
});
40
44
41
45
app.visit('/photos', options)
@@ -68,7 +72,7 @@ configuration:
68
72
-`shouldRender`: boolean to indicate whether the app should do rendering or not. If set to false, it puts the app in routing-only. Defaults to true.
69
73
-`disableShoebox`: boolean to indicate whether we should send the API data in the shoebox. If set to false, it will not send the API data used for rendering the app on server side in the index.html. Defaults to false.
70
74
-`destroyAppInstanceInMs`: whether to destroy the instance in the given number of ms. This is a failure mechanism to not wedge the Node process
71
-
-`buildSandboxPerVisit`: whether to create a new sandbox context per-visit (slows down each visit, but guarantees no prototype leakages can occur), or reuse the existing sandbox (faster per-request, but each request shares the same set of prototypes). Defaults to false.
75
+
-`buildSandboxPerVisit`: whether to create a new sandbox context per-visit (slows down each visit, but guarantees no prototype leakages can occur), or reuse the existing sandbox (faster per-request, but each request shares the same set of prototypes). Defaults to false. When using this flag, also set `maxSandboxQueue` to represent the QPS of your application so that sandboxes can be queued for next requests. When not provided, it defaults to storing only one sandbox
72
76
73
77
### Build Your App
74
78
@@ -107,6 +111,43 @@ rendering your Ember.js application using the [FastBoot App Server](https://gith
107
111
Run `fastboot` with the `DEBUG` environment variable set to `fastboot:*`
108
112
for detailed logging.
109
113
114
+
### Result
115
+
116
+
The result from `fastboot` is a `Result` object that has the following API:
117
+
118
+
```
119
+
120
+
type DOMContents = () => {
121
+
/**
122
+
The `<head>` contents generated by the visit.
123
+
*/
124
+
head: string;
125
+
126
+
/**
127
+
The `<body>` contents generated by the visit.
128
+
*/
129
+
body: string;
130
+
}
131
+
132
+
interface FastBootVisitResult {
133
+
/**
134
+
The serialized DOM contents after completing the `visit` request.
135
+
136
+
Note: this combines the `domContents.head` and `domContents.body`.
137
+
*/
138
+
html(): string;
139
+
140
+
domContents(): DOMContents
141
+
142
+
analytics: {
143
+
/**
144
+
* Boolean to know if the request used a prebuilt sandbox
145
+
*/
146
+
usedPrebuiltSandbox: <Boolean>
147
+
}
148
+
}
149
+
```
150
+
110
151
### The Shoebox
111
152
112
153
You can pass application state from the FastBoot rendered application to
Copy file name to clipboardExpand all lines: src/index.js
+10-3Lines changed: 10 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -41,9 +41,10 @@ class FastBoot {
41
41
* @param {string} options.distPath the path to the built Ember application
42
42
* @param {Boolean} [options.resilient=false] if true, errors during rendering won't reject the `visit()` promise but instead resolve to a {@link Result}
43
43
* @param {Function} [options.buildSandboxGlobals] a function used to build the final set of global properties setup within the sandbox
44
+
* @param {Number} [options.maxSandboxQueueSize] - maximum sandbox queue size when using buildSandboxPerRequest flag.
0 commit comments