@live-change/dao-vue
Advanced tools
Comparing version 0.1.4 to 0.1.5
43
index.js
@@ -7,3 +7,3 @@ | ||
if(!options || !options.dao) throw new Error("dao option required") | ||
let dao = options.dao | ||
const dao = options.dao | ||
@@ -60,2 +60,4 @@ Vue.mixin({ | ||
reactiveObservables[key].bindErrorProperty(this, key+"Error") | ||
} else { | ||
this[key] = undefined | ||
} | ||
@@ -135,2 +137,41 @@ }) | ||
}) | ||
Vue.component('reactive', { | ||
name: "Observe", | ||
props: { | ||
what: { | ||
type: Object | ||
} | ||
}, | ||
data() { | ||
let values = {}, errors = {} | ||
for(const key in this.what) { | ||
values[key] = undefined | ||
values[key + 'Error'] = undefined | ||
} | ||
return { | ||
values | ||
} | ||
}, | ||
created() { | ||
this.observables = {} | ||
for(const name in this.what) { | ||
const what = this.what[key] | ||
const observable = dao.observable(what) | ||
this.observables[name] = observable | ||
observable.bindProperty(this.values[name]) | ||
observable.bindErrorProperty(this.values[name+'Error']) | ||
} | ||
}, | ||
beforeDestroy() { | ||
for(const name in this.observables) { | ||
const observable = this.observables[name] | ||
observable.unbindProperty(this, "reactivePreFetchedPaths") | ||
observable.unbindErrorProperty(this, "reactivePreFetchError") | ||
} | ||
}, | ||
render(createElement) { | ||
return this.$scopedSlots.default(this.values)[0] | ||
} | ||
}) | ||
} | ||
@@ -137,0 +178,0 @@ } |
{ | ||
"name": "@live-change/dao-vue", | ||
"version": "0.1.4", | ||
"version": "0.1.5", | ||
"author": { | ||
@@ -13,3 +13,3 @@ "email": "m8@em8.pl", | ||
"dependencies": { | ||
"@live-change/dao": "^0.2.14" | ||
"@live-change/dao": "^0.2.16" | ||
}, | ||
@@ -16,0 +16,0 @@ "devDependencies": {}, |
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
8318
170
Updated@live-change/dao@^0.2.16