Skip to content

Commit c46d124

Browse files
patinthehatPatrick
authored andcommitted
update to use named exports in examples, minor other changes
1 parent 8499761 commit c46d124

File tree

1 file changed

+54
-52
lines changed

1 file changed

+54
-52
lines changed

README.md

Lines changed: 54 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@ yarn add vue-ray
3333

3434
When using in a Vue 3.x project (the default), import package normally:
3535

36-
```js
36+
```js
3737
import { createApp } from 'vue';
3838
import App from './App.vue';
3939

4040
// as an es module import:
41-
import RayPlugin from 'vue-ray';
41+
import { RayPlugin } from 'vue-ray';
4242

4343
// or as a commonjs import:
4444
const { RayPlugin } = require('vue-ray');
@@ -52,11 +52,11 @@ app.use(RayPlugin, { interceptErrors: true, port: 23500, showComponentEvents: ['
5252

5353
When using in a Vue 2.x project, import the 'vue2' variant:
5454

55-
```js
55+
```js
5656
const Vue = require('vue');
5757

5858
// as an es module import:
59-
import RayPlugin from 'vue-ray/vue2';
59+
import { RayPlugin } from 'vue-ray/vue2';
6060

6161
// or as a commonjs import:
6262
const { RayPlugin } = require('vue-ray/vue2');
@@ -66,24 +66,24 @@ Vue.use(RayPlugin, { interceptErrors: true, host: '127.0.0.1', showComponentEven
6666

6767
### Installation options
6868

69-
| Name | Type | Default | Description |
70-
| --- | --- | --- | --- |
71-
| `host` | `string` | `localhost` | host to connect to the Ray app on |
72-
| `interceptErrors` | `boolean` | `false` | send Vue errors to Ray |
73-
| `port` | `number` | `23517` | port to connect to the Ray app on |
74-
| `showComponentEvents` | `string[]` | `[]` | display component events in Ray, see below for possible values |
69+
| Name | Type | Default | Description |
70+
| --------------------- | ---------- | ----------- | -------------------------------------------------------------- |
71+
| `host` | `string` | `localhost` | host to connect to the Ray app on |
72+
| `interceptErrors` | `boolean` | `false` | send Vue errors to Ray |
73+
| `port` | `number` | `23517` | port to connect to the Ray app on |
74+
| `showComponentEvents` | `string[]` | `[]` | display component events in Ray, see below for possible values |
7575

7676
### Component events
7777

7878
Component lifecycle events can be sent to Ray using the `showComponentEvents` plugin option _(`array`)_.
7979

8080
Any or all of the following values can be used with this option:
8181

82-
- `before-create`
83-
- `before-mount`
84-
- `created`
85-
- `mounted`
86-
- `updated`
82+
- `before-create`
83+
- `before-mount`
84+
- `created`
85+
- `mounted`
86+
- `updated`
8787

8888
## Usage
8989

@@ -93,12 +93,12 @@ See the [node-ray reference](https://github.com/permafrost-dev/node-ray#referenc
9393

9494
## Vue-specific methods
9595

96-
| Name | Description |
97-
| --- | --- |
98-
| `this.$ray().data()` | show the component data |
99-
| `this.$ray().props()` | show the component props |
100-
| `this.$ray().ref(name)` | show the `innerHTML` of a named ref |
101-
| `this.$ray().track(name)` | display changes to a component's data variable |
96+
| Name | Description |
97+
| --------------------------- | ------------------------------------------------------ |
98+
| `this.$ray().data()` | show the component data |
99+
| `this.$ray().props()` | show the component props |
100+
| `this.$ray().ref(name)` | show the `innerHTML` of a named ref |
101+
| `this.$ray().track(name)` | display changes to a component's data variable |
102102
| `this.$ray().untrack(name)` | stop displaying changes to a component's data variable |
103103

104104
## Tracking component data
@@ -120,9 +120,11 @@ export default {
120120
this.$ray().track('one');
121121
},
122122
mounted() {
123-
setInterval( () => { this.one += 3; }, 4000);
124-
}
125-
}
123+
setInterval(() => {
124+
this.one += 3;
125+
}, 4000);
126+
},
127+
};
126128
</script>
127129
```
128130

@@ -188,31 +190,31 @@ Vue.use(RayPlugin, { interceptErrors: true });
188190

189191
In either a Vue 2.x or 3.x project, you may use the `vue-ray` vuex plugin - it can track the vuex state, log mutations and log actions.
190192

191-
To use it, import the `RayVuexPlugin` function from `vue-ray` _(`vue-ray/vue2` for Vue 2)_, and pass the result of the function to the `plugins` property on your Vuex store:
193+
To use it, import the `RayVuexPlugin` function from `vue-ray`, and pass the result of the function to the `plugins` property on your Vuex store:
192194

193195
```js
194196
// ...
195197

196-
import { RayVuexPlugin } from 'vue-ray'; // or 'vue-ray/vue2' if using Vue 2.x
198+
import { RayVuexPlugin } from 'vue-ray'; // for both vue 2 and vue 3
197199

198200
// ...
199201

200202
const storeObj = {
201-
state: {
202-
one: 11,
203-
two: 22,
204-
},
205-
mutations: {
206-
incrementOne(state) {
207-
state.one += 1;
203+
state: {
204+
one: 11,
205+
two: 22,
208206
},
209-
incrementTwo(state) {
210-
state.two += 2;
207+
mutations: {
208+
incrementOne(state) {
209+
state.one += 1;
210+
},
211+
incrementTwo(state) {
212+
state.two += 2;
213+
},
211214
},
212-
},
213-
actions: {},
214-
modules: {},
215-
plugins: [RayVuexPlugin({trackState: true, logMutations: true})],
215+
actions: {},
216+
modules: {},
217+
plugins: [RayVuexPlugin({ trackState: true, logMutations: true })],
216218
};
217219

218220
// Vue 3:
@@ -224,25 +226,25 @@ export default new Vuex.Store(storeObj);
224226

225227
### Vuex plugin options
226228

227-
| Name | Type | Description |
228-
| --- | --- | --- |
229-
| `trackState` | `boolean` | track the data in the store's state |
230-
| `logMutations` | `boolean` | log all fired mutations to Ray |
231-
| `logActions` | `boolean` | log all fired actions to Ray |
232-
| `loggedMutationColor` | `string` | send logged mutations with the specified Ray color |
233-
| `loggedActionColor` | `string` | send logged actions with the specified Ray color |
229+
| Name | Type | Description |
230+
| --------------------- | --------- | -------------------------------------------------- |
231+
| `trackState` | `boolean` | track the data in the store's state |
232+
| `logMutations` | `boolean` | log all fired mutations to Ray |
233+
| `logActions` | `boolean` | log all fired actions to Ray |
234+
| `loggedMutationColor` | `string` | send logged mutations with the specified Ray color |
235+
| `loggedActionColor` | `string` | send logged actions with the specified Ray color |
234236

235237
Valid color names are `blue`, `gray`, `green`, `orange`, `purple`, `red`, and `none`.
236238

237239
## Development setup
238240

239-
- `npm install`
240-
- `npm run test`
241-
- `npm run build:all`
241+
- `npm install`
242+
- `npm run test`
243+
- `npm run build:all`
242244

243245
## Testing
244246

245-
`vue-ray` uses Jest for unit tests. To run the test suite:
247+
`vue-ray` uses Jest for unit tests. To run the test suite:
246248

247249
`npm run test`
248250

@@ -262,8 +264,8 @@ Please review [our security policy](../../security/policy) on how to report secu
262264

263265
## Credits
264266

265-
- [Patrick Organ](https://github.com/patinthehat)
266-
- [All Contributors](../../contributors)
267+
- [Patrick Organ](https://github.com/patinthehat)
268+
- [All Contributors](../../contributors)
267269

268270
## License
269271

0 commit comments

Comments
 (0)