vue-property-decorator
Advanced tools
Comparing version 7.1.1 to 7.2.0
@@ -1,2 +0,2 @@ | ||
/** vue-property-decorator verson 7.1.1 MIT LICENSE copyright 2018 kaorun343 */ | ||
/** vue-property-decorator verson 7.2.0 MIT LICENSE copyright 2018 kaorun343 */ | ||
import Vue, { PropOptions, WatchOptions } from 'vue'; | ||
@@ -3,0 +3,0 @@ import Component, { mixins } from 'vue-class-component'; |
@@ -1,2 +0,2 @@ | ||
/** vue-property-decorator verson 7.1.1 MIT LICENSE copyright 2018 kaorun343 */ | ||
/** vue-property-decorator verson 7.2.0 MIT LICENSE copyright 2018 kaorun343 */ | ||
'use strict'; | ||
@@ -91,6 +91,7 @@ import Vue from 'vue'; | ||
export function Emit(event) { | ||
return function (target, key, descriptor) { | ||
return function (_target, key, descriptor) { | ||
key = hyphenate(key); | ||
var original = descriptor.value; | ||
descriptor.value = function emitter() { | ||
var _this = this; | ||
var args = []; | ||
@@ -100,8 +101,21 @@ for (var _i = 0; _i < arguments.length; _i++) { | ||
} | ||
var emit = function (returnValue) { | ||
if (returnValue !== undefined) | ||
args.unshift(returnValue); | ||
_this.$emit.apply(_this, [event || key].concat(args)); | ||
}; | ||
var returnValue = original.apply(this, args); | ||
if (returnValue !== undefined) | ||
args.unshift(returnValue); | ||
this.$emit.apply(this, [event || key].concat(args)); | ||
if (isPromise(returnValue)) { | ||
returnValue.then(function (returnValue) { | ||
emit(returnValue); | ||
}); | ||
} | ||
else { | ||
emit(returnValue); | ||
} | ||
}; | ||
}; | ||
} | ||
function isPromise(obj) { | ||
return obj instanceof Promise || (obj && typeof obj.then === 'function'); | ||
} |
@@ -10,3 +10,3 @@ (function (global, factory) { | ||
/** vue-property-decorator verson 7.1.1 MIT LICENSE copyright 2018 kaorun343 */ | ||
/** vue-property-decorator verson 7.2.0 MIT LICENSE copyright 2018 kaorun343 */ | ||
'use strict'; | ||
@@ -98,6 +98,7 @@ /** | ||
function Emit(event) { | ||
return function (target, key, descriptor) { | ||
return function (_target, key, descriptor) { | ||
key = hyphenate(key); | ||
var original = descriptor.value; | ||
descriptor.value = function emitter() { | ||
var _this = this; | ||
var args = []; | ||
@@ -107,9 +108,22 @@ for (var _i = 0; _i < arguments.length; _i++) { | ||
} | ||
var emit = function (returnValue) { | ||
if (returnValue !== undefined) | ||
args.unshift(returnValue); | ||
_this.$emit.apply(_this, [event || key].concat(args)); | ||
}; | ||
var returnValue = original.apply(this, args); | ||
if (returnValue !== undefined) | ||
args.unshift(returnValue); | ||
this.$emit.apply(this, [event || key].concat(args)); | ||
if (isPromise(returnValue)) { | ||
returnValue.then(function (returnValue) { | ||
emit(returnValue); | ||
}); | ||
} | ||
else { | ||
emit(returnValue); | ||
} | ||
}; | ||
}; | ||
} | ||
function isPromise(obj) { | ||
return obj instanceof Promise || (obj && typeof obj.then === 'function'); | ||
} | ||
@@ -116,0 +130,0 @@ exports.Component = vueClassComponent__default; |
{ | ||
"name": "vue-property-decorator", | ||
"version": "7.1.1", | ||
"version": "7.2.0", | ||
"description": "property decorators for Vue Component", | ||
@@ -18,4 +18,3 @@ "main": "lib/vue-property-decorator.umd.js", | ||
"scripts": { | ||
"build": "tsc -p src/tsconfig.json", | ||
"build:umd": "rollup -c", | ||
"build": "tsc -p src/tsconfig.json && rollup -c", | ||
"test": "webpack --config ./test/webpack.config.js && ava test/decorator.spec.js" | ||
@@ -22,0 +21,0 @@ }, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
17360
302