Skip to content

Commit 576ff7a

Browse files
Separate the vue-class-component decorator into its own package.
This takes the decorator implementation contributed in foxbenjaminfox/vue-async-computed#88 and puts it into its own package. It also adds a few tests for the decorator.
0 parents  commit 576ff7a

11 files changed

+9006
-0
lines changed

Diff for: .babelrc

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"plugins": [
3+
"@babel/plugin-transform-runtime",
4+
["@babel/plugin-proposal-decorators", { "legacy": true }]
5+
]
6+
}

Diff for: .eslintrc

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"extends": "standard",
3+
"env": {
4+
"node": true,
5+
"es6": true
6+
},
7+
"rules": {
8+
"comma-dangle": [
9+
2,
10+
"only-multiline"
11+
],
12+
"one-var": 0
13+
}
14+
}

Diff for: .gitignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.DS_Store
2+
*.log
3+
node_modules/
4+
/.cache/
5+
/test/dist/

Diff for: .travis.yml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
language: node_js
2+
node_js:
3+
- v12
4+
- v10
5+
- v8

Diff for: LICENSE

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
Copyright (c) 2019 Benjamin Fox <[email protected]>
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy of
4+
this software and associated documentation files (the "Software"), to deal in
5+
the Software without restriction, including without limitation the rights to
6+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
7+
the Software, and to permit persons to whom the Software is furnished to do so,
8+
subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in all
11+
copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
15+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
16+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.))

Diff for: README.md

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<big><h1 align="center">vue-async-computed-decorator</h1></big>
2+
3+
<p align="center">
4+
<a href="https://npmjs.org/package/vue-async-computed-decorator">
5+
<img src="https://img.shields.io/npm/v/vue-async-computed-decorator.svg?style=flat-square"
6+
alt="NPM Version">
7+
</a>
8+
9+
<a href="https://travis-ci.org/foxbenjaminfox/vue-async-computed-decorator">
10+
<img src="https://img.shields.io/travis/foxbenjaminfox/vue-async-computed-decorator.svg?style=flat-square"
11+
alt="Build Status">
12+
</a>
13+
14+
<a href="https://npmjs.org/package/vue-async-computed-decorator">
15+
<img src="https://img.shields.io/npm/dm/vue-async-computed-decorator.svg?style=flat-square"
16+
alt="Downloads">
17+
</a>
18+
19+
<a href="https://david-dm.org/foxbenjaminfox/vue-async-computed-decorator.svg">
20+
<img src="https://david-dm.org/foxbenjaminfox/vue-async-computed-decorator.svg?style=flat-square"
21+
alt="Dependency Status">
22+
</a>
23+
24+
<a href="https://github.com/foxbenjaminfox/vue-async-computed-decorator/blob/master/LICENSE">
25+
<img src="https://img.shields.io/npm/l/vue-async-computed-decorator.svg?style=flat-square"
26+
alt="License">
27+
</a>
28+
</p>
29+
30+
This package provides a [`vue-class-component`](https://github.com/vuejs/vue-class-component/) decorator for [`vue-async-computed`](https://github.com/foxbenjaminfox/vue-async-computed). This allows you to use `vue-async-computed` in your class-style Vie components easily.
31+
32+
## Usage Example:
33+
34+
```javascript
35+
import Vue from 'vue'
36+
import AsyncComputedPlugin from 'vue-async-computed'
37+
import AsyncComputed from 'vue-async-computed-decorator'
38+
import Component from 'vue-class-component'
39+
40+
Vue.use(AsyncComputedPlugin)
41+
42+
@Component
43+
class MyComponent extends Vue {
44+
@AsyncComputed
45+
async someComputedProp() {
46+
...
47+
}
48+
}
49+
```
50+
51+
## Credits
52+
53+
Thanks to [@TheNoim](https://github.com/TheNoim), [@saraedum](https://github.com/saraedum), and [@nwtgck](https://github.com/nwtgck) for the implementation of this decorator.

0 commit comments

Comments
 (0)