This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// composables/useFeedbackWidget.js | |
export const useFeedbackWidget = () => { | |
const loadWidgetScript = () => | |
new Promise((resolve, reject) => { | |
if (window.FeedbackWidget) return resolve(); // Already loaded | |
const existingScript = document.querySelector('script[src*="widget.js"]'); | |
if (existingScript) { | |
existingScript.addEventListener('load', () => resolve()); | |
return; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<Head> | |
<Title>Joto Feedback - Collect feedback the modern way</Title> | |
<Link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/joto-team/widget-build@latest/joto-feedback-widget.css"></Link> | |
</Head> | |
<div id="feedback-widget"></div> | |
</template> | |
<script setup> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8" /> | |
<title>Feedback Widget Example</title> | |
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/joto-team/widget-build@latest/joto-feedback-widget.css"> | |
</head> | |
<body> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
... | |
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/joto-team/widget-build@latest/joto-feedback-widget.css"> | |
</head> | |
<body> | |
... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
... | |
<-- Add this before closing </head> section--> | |
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/joto-team/widget-build@latest/joto-feedback-widget.css"> | |
</head> | |
<body> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
... | |
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/joto-team/widget-build@latest/joto-feedback-widget.css"> | |
</head> | |
<body> | |
... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default defineNuxtPlugin(() => { | |
return { | |
provide: { | |
locally: { | |
getItem(item) { | |
if (process.client) { | |
return localStorage.getItem(item) | |
} else { | |
return undefined | |
} |