@unhead/vue 1.9.1 → 1.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -108,15 +108,15 @@ function useScript(_input, _options) {
108
108
  });
109
109
  }
110
110
  };
111
- const instance = unhead.useScript(input, options);
112
- function syncStatus({ script }) {
113
- if (script.id === instance.$script.id) {
111
+ let instance;
112
+ const rmHook = head.hooks.hook("script:updated", ({ script }) => {
113
+ if (instance && script.id === instance.$script.id) {
114
114
  status.value = script.status;
115
115
  if (script.status === "removed")
116
- head.hooks.removeHook("script:updated", syncStatus);
116
+ rmHook();
117
117
  }
118
- }
119
- head.hooks.hook("script:updated", syncStatus);
118
+ });
119
+ instance = unhead.useScript(input, options);
120
120
  return instance;
121
121
  }
122
122
 
package/dist/index.mjs CHANGED
@@ -108,15 +108,15 @@ function useScript(_input, _options) {
108
108
  });
109
109
  }
110
110
  };
111
- const instance = useScript$1(input, options);
112
- function syncStatus({ script }) {
113
- if (script.id === instance.$script.id) {
111
+ let instance;
112
+ const rmHook = head.hooks.hook("script:updated", ({ script }) => {
113
+ if (instance && script.id === instance.$script.id) {
114
114
  status.value = script.status;
115
115
  if (script.status === "removed")
116
- head.hooks.removeHook("script:updated", syncStatus);
116
+ rmHook();
117
117
  }
118
- }
119
- head.hooks.hook("script:updated", syncStatus);
118
+ });
119
+ instance = useScript$1(input, options);
120
120
  return instance;
121
121
  }
122
122
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@unhead/vue",
3
3
  "type": "module",
4
- "version": "1.9.1",
4
+ "version": "1.9.2",
5
5
  "author": "Harlan Wilton <harlan@harlanzw.com>",
6
6
  "license": "MIT",
7
7
  "funding": "https://github.com/sponsors/harlan-zw",
@@ -61,9 +61,9 @@
61
61
  },
62
62
  "dependencies": {
63
63
  "hookable": "^5.5.3",
64
- "unhead": "1.9.1",
65
- "@unhead/schema": "1.9.1",
66
- "@unhead/shared": "1.9.1"
64
+ "@unhead/schema": "1.9.2",
65
+ "unhead": "1.9.2",
66
+ "@unhead/shared": "1.9.2"
67
67
  },
68
68
  "devDependencies": {
69
69
  "vue": "^3.4.21"