Skip to content

Commit f1c1e8e

Browse files
authored
Merge pull request #1226 from basics/feature/improvements
fix(composable): added default values
2 parents da1cd91 + fd44a20 commit f1c1e8e

File tree

5 files changed

+10
-11
lines changed

5 files changed

+10
-11
lines changed

docs/src/guide/options.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ title: Options
1111
- Valid values: `anonymous`, `use-credentials`, `''`, `true`, `false`
1212

1313
Sets the global `crossorigin` value of the **Nuxt Booster** preloads.
14-
The default value is the `crossorigin` value from the [Render Configuration](https://nuxtjs.org/docs/2.x/configuration-glossary/configuration-render#crossorigin).
14+
1515
> Set `false` to disable the `crossorigin`.
1616
1717
[MDN - HTML.Attributes.crossorigin](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/crossorigin)

docs/src/guide/setup.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ Install `nuxt-booster` as a dependency to your project:
2020
npm install nuxt-booster
2121
```
2222

23+
```bash [PNPM]
24+
pnpm add nuxt-booster
25+
```
26+
2327
:::
2428

2529
Add `nuxt-booster` to the `modules` section of `nuxt.config.js`:

src/runtime/composables/useBoosterComponentObserver.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { getElementObserver } from '#booster/classes/intersection';
22
import { useBoosterCritical } from '#imports';
33
import { onMounted, ref } from 'vue';
44

5-
export default function (options) {
5+
export default function (options = {}) {
66
const el = ref(null);
77
const inView = ref(false);
88

src/runtime/composables/useBoosterCritical.js

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,11 @@ import { useAttrs, provide, inject, ref, computed } from 'vue';
22

33
const criticalContextKey = Symbol('criticalContext');
44

5-
/**
6-
*
7-
* @param {*} param0
8-
* @returns {
9-
* isCritical: import('vue').ComputedRef<boolean>,}
10-
*
11-
*/
12-
export default function ({ critical } = {}) {
5+
export default function (context = {}) {
136
const attrs = useAttrs();
147

8+
const { critical } = { critical: undefined, ...context };
9+
1510
const currentCritical = ref(
1611
!('critical' in attrs)
1712
? critical

src/runtime/composables/useBoosterFonts.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import FontCollection from '#booster/classes/FontCollection';
22
import { useBoosterCritical, useBoosterConfig, useNuxtApp } from '#imports';
33
import { reactive, nextTick, onBeforeUnmount } from 'vue';
44

5-
export default function (context) {
5+
export default function (context = {}) {
66
const { isCritical, critical } = useBoosterCritical(context);
77

88
const runtimeConfig = useBoosterConfig();

0 commit comments

Comments
 (0)