Skip to content
This repository was archived by the owner on Jan 8, 2019. It is now read-only.

Commit 4a2cd55

Browse files
committed
Add readme for example
1 parent 0272c12 commit 4a2cd55

File tree

3 files changed

+42
-6
lines changed

3 files changed

+42
-6
lines changed

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ You can opt to install the package from npm, using the instructions below. Alter
1313
### CDN
1414

1515
```html
16-
<script src="//d2wy8f7a9ursnm.cloudfront.net/bugsnag-plugins/bugsnag-vue/v1/bugsnag-vue.min.js"></script>
16+
<script src="//d2wy8f7a9ursnm.cloudfront.net/bugsnag/v4/bugsnag.min.js"></script>
17+
<script src="//d2wy8f7a9ursnm.cloudfront.net/bugsnag-plugins/v1/bugsnag-vue.min.js"></script>
1718
```
1819

1920
### npm
@@ -40,6 +41,8 @@ The script tag creates a global function called `bugsnag__vue` which needs to be
4041
</script>
4142
```
4243

44+
See the [example](example) for more info.
45+
4346
### Bundled
4447

4548
If you installed the package from npm, usage will look more like the following snippet. Again, ensure you have a reference to `Vue` before you create the plugin.

example/README.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Bugsnag: Vue.js Example
2+
3+
This example shows how you can use the Bugsnag JavaScript notifier with
4+
[Vue.js](https://vuejs.org/).
5+
6+
Whilst the notifier reports any errors that are uncaught, there are certain types
7+
of error specific to Vue.js that get swallowed by its own error handler. The example
8+
shown here shows how to use the `bugsnag-vue` plugin to this work for you.
9+
10+
## Setup
11+
12+
Try this out with [your own Bugsnag account](https://app.bugsnag.com/user/new)!
13+
You'll be able to see how the errors are reported in the dashboard, how breadcrumbs
14+
are left, how errors are grouped and how they relate to the original source.
15+
16+
To get set up, follow the instructions below. Don't forget to replace the placeholder
17+
API token with your own!
18+
19+
1. Clone the repo and `cd` this this directory:
20+
```sh
21+
git clone git@github.com:bugsnag/bugsnag-vue.git
22+
cd bugsnag-vue
23+
```
24+
1. Install the dependencies (with either npm or yarn):
25+
```sh
26+
npm i
27+
```
28+
```sh
29+
yarn
30+
```
31+
1. Replace the `API_KEY` placeholder in [index.html](index.html) with your actual API key.
32+
1. Start a web server:
33+
```sh
34+
npm start
35+
```
36+
1. View the example page which will (most likely) be served at: http://localhost:5000/

example/index.html

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,8 @@
66
<script src="node_modules/bugsnag-js/dist/bugsnag.js"></script>
77
<script src="node_modules/bugsnag-vue/dist/bugsnag-vue.js"></script>
88
<script>
9-
window.bugsnagClient = bugsnag({
10-
apiKey: '19094d99b21f3a2a6f47910f9531fc83',
11-
// endpoint: '//localhost:8000'
12-
})
13-
bugsnag__vue(Vue, bugsnagClient)
9+
window.bugsnagClient = bugsnag('API_KEY')
10+
bugsnagClient.use(bugsnag__vue(Vue))
1411
</script>
1512
</head>
1613
<style>

0 commit comments

Comments
 (0)