-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix typo
- Loading branch information
Showing
6 changed files
with
109 additions
and
11 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
VITE_TELEMENTRYDECK_APP_ID=telementryDeckAppId | ||
VITE_TELEMETRYDECK_APP_ID=telementryDeckAppId |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,107 @@ | ||
# Vue 3 + TypeScript + Vite | ||
# telemetrydeck-vue | ||
|
||
A library for using TelemetryDeck in your React app. | ||
|
||
[![semantic-release: angular](https://img.shields.io/badge/semantic--release-angular-e10079?logo=semantic-release)](https://github.com/semantic-release/semantic-release) | ||
|
||
## Installation | ||
|
||
```shell | ||
npm i @peerigon/telemetrydeck-vue --save | ||
``` | ||
|
||
## Setup | ||
|
||
Set up the plugin in your application setup: | ||
|
||
```javascript | ||
import TelemetryDeckPlugin from '@peerigon/telemetrydeck-vue'; | ||
|
||
const app = createApp(App); | ||
app.use(TelemetryDeckPlugin, { | ||
appID: "{your telemetrydeck appID}", | ||
testMode: true, // optional - defaults to false | ||
clientUser: 'Guest' // optional - defaults to 'Guest' | ||
}); | ||
|
||
app.mount('#app'); | ||
``` | ||
|
||
## Basic Usage | ||
|
||
```vue | ||
<script setup lang="ts"> | ||
import { useTelemetryDeck } from "@peerigon/telemetrydeck-vue"; | ||
const { signal, queue, setClientUser } = useTelemetryDeck(); | ||
const changeClientUserClick = () => { | ||
setClientUser('user' + Math.floor(Math.random() * 1000)); | ||
}; | ||
const buttonSignalClick = () => { | ||
signal('example_signal_event_name', { | ||
custom_data: 'other_data', // any custom data as required | ||
}); | ||
}; | ||
const buttonQueueClick = () => { | ||
queue('example_queue_event_name', { | ||
custom_data: 'other_data', // any custom data as required | ||
}); | ||
}; | ||
const buttonSignalClickWithOptions = () => { | ||
signal('example_signal_event_name_with_options', { | ||
custom_data: 'other_data', // any custom data as required | ||
}, { | ||
testMode: true, | ||
clientUser: 'other_user', | ||
appID: 'other_app_id', | ||
}); // telemetryDeck options (optional) | ||
}; | ||
const buttonQueueClickWithOptions = () => { | ||
queue('example_queue_event_name_with_options', { | ||
custom_data: 'other_data', // any custom data as required | ||
}, { | ||
testMode: true, | ||
clientUser: 'other_user', | ||
appID: 'other_app_id', | ||
}); // telemetryDeck options (optional) | ||
}; | ||
</script> | ||
<template> | ||
<div> | ||
<div> | ||
<button id="btnSignalClick" @click="buttonSignalClick">Log a click with signal</button> | ||
<button id="btnQueueClick" @click="buttonQueueClick">Log a click with queue</button> | ||
<button id="btnSetClient" @click="changeClientUserClick">Change user</button> | ||
</div> | ||
<div> | ||
<button id="btnSignalClickWithOptions" @click="buttonSignalClickWithOptions">Log a click with signal with Options</button> | ||
<button id="btnQueueClickWithOptions" @click="buttonQueueClickWithOptions">Log a click with queue with Options</button> | ||
</div> | ||
</div> | ||
</template> | ||
``` | ||
|
||
## Contributions | ||
|
||
### Local Development | ||
|
||
To run the plugin locally for development: | ||
|
||
1. Install Node.js v20 | ||
2. Run `npm i` | ||
3. create .env file from .env.example and add your test telemetryDeck appID. Create an account here: [telemetrydeck.com](https://telemetrydeck.com/) | ||
3. Run `npm run dev` | ||
4. Navigate to [http://localhost:5173/](http://localhost:5173/) for the test page | ||
|
||
### Tests | ||
|
||
This template should help get you started developing with Vue 3 and TypeScript in Vite. The template uses Vue 3 `<script setup>` SFCs, check out the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more. | ||
Run the tests with: | ||
|
||
Learn more about the recommended Project Setup and IDE Support in the [Vue Docs TypeScript Guide](https://vuejs.org/guide/typescript/overview.html#project-setup). | ||
```shell | ||
npm run test | ||
``` |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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