publish: omi v6.15.2, remove store's component when uninstall

This commit is contained in:
dntzhang 2019-10-08 15:30:59 +08:00
parent 238253e43e
commit 45343e0fbc
11 changed files with 68 additions and 25 deletions

View File

@ -1,5 +1,5 @@
/**
* omi v6.15.1 http://omijs.org
* omi v6.15.2 http://omijs.org
* Omi === Preact + Scoped CSS + Store System + Native Support in 3kb javascript.
* By dntzhang https://github.com/dntzhang
* Github: https://github.com/Tencent/omi
@ -914,10 +914,22 @@
this.uninstall();
this._isInstalled = false;
if (this.store) {
for (var i = 0, len = this.store.instances.length; i < len; i++) {
if (this.store.instances[i] === this) {
this.store.instances.splice(i, 1);
break;
if (options.isMultiStore) {
for (var key in this.store) {
var current = this.store[key];
for (var i = 0, len = current.instances.length; i < len; i++) {
if (current.instances[i] === this) {
current.instances.splice(i, 1);
break;
}
}
}
} else {
for (var i = 0, _len = this.store.instances.length; i < _len; i++) {
if (this.store.instances[i] === this) {
this.store.instances.splice(i, 1);
break;
}
}
}
}
@ -1774,7 +1786,7 @@
options.root.Omi = omi;
options.root.omi = omi;
options.root.Omi.version = '6.15.1';
options.root.Omi.version = '6.15.2';
if (typeof module != 'undefined') module.exports = omi;else self.Omi = omi;
}());

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,5 @@
/**
* omi v6.15.1 http://omijs.org
* omi v6.15.2 http://omijs.org
* Omi === Preact + Scoped CSS + Store System + Native Support in 3kb javascript.
* By dntzhang https://github.com/dntzhang
* Github: https://github.com/Tencent/omi
@ -911,10 +911,22 @@ var WeElement = function (_HTMLElement) {
this.uninstall();
this._isInstalled = false;
if (this.store) {
for (var i = 0, len = this.store.instances.length; i < len; i++) {
if (this.store.instances[i] === this) {
this.store.instances.splice(i, 1);
break;
if (options.isMultiStore) {
for (var key in this.store) {
var current = this.store[key];
for (var i = 0, len = current.instances.length; i < len; i++) {
if (current.instances[i] === this) {
current.instances.splice(i, 1);
break;
}
}
}
} else {
for (var i = 0, _len = this.store.instances.length; i < _len; i++) {
if (this.store.instances[i] === this) {
this.store.instances.splice(i, 1);
break;
}
}
}
}
@ -1771,7 +1783,7 @@ var omi = {
options.root.Omi = omi;
options.root.omi = omi;
options.root.Omi.version = '6.15.1';
options.root.Omi.version = '6.15.2';
export default omi;
export { tag, WeElement, Component, render, h, h as createElement, options, define, cloneElement, getHost, rpx, defineElement, classNames, extractClass, createRef, html, htm, o, elements, $, extend$1 as extend, get, set, bind, unbind, JSONPatcherProxy as JSONProxy };

File diff suppressed because one or more lines are too long

View File

@ -691,7 +691,13 @@
WeElement.prototype.disconnectedCallback = function() {
this.uninstall();
this.B = !1;
if (this.store) for (var i = 0, len = this.store.instances.length; i < len; i++) if (this.store.instances[i] === this) {
if (this.store) if (options.isMultiStore) for (var key in this.store) {
var current = this.store[key];
for (var i = 0, len = current.instances.length; i < len; i++) if (current.instances[i] === this) {
current.instances.splice(i, 1);
break;
}
} else for (var i = 0, _len = this.store.instances.length; i < _len; i++) if (this.store.instances[i] === this) {
this.store.instances.splice(i, 1);
break;
}
@ -1032,7 +1038,7 @@
};
options.root.Omi = omi;
options.root.omi = omi;
options.root.Omi.version = '6.15.1';
options.root.Omi.version = '6.15.2';
if ('undefined' != typeof module) module.exports = omi; else self.Omi = omi;
}();
//# sourceMappingURL=omi.js.map

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
{
"name": "omi",
"version": "6.15.1",
"version": "6.15.2",
"description": "Front End Cross-Frameworks Framework.",
"main": "dist/omi.js",
"jsnext:main": "dist/omi.esm.js",

View File

@ -55,7 +55,7 @@ const omi = {
options.root.Omi = omi
options.root.omi = omi
options.root.Omi.version = '6.15.1'
options.root.Omi.version = '6.15.2'
export default omi

View File

@ -134,12 +134,25 @@ export default class WeElement extends HTMLElement {
this.uninstall()
this._isInstalled = false
if (this.store) {
for (let i = 0, len = this.store.instances.length; i < len; i++) {
if (this.store.instances[i] === this) {
this.store.instances.splice(i, 1)
break
if(options.isMultiStore){
for(let key in this.store){
const current = this.store[key]
for (let i = 0, len = current.instances.length; i < len; i++) {
if (current.instances[i] === this) {
current.instances.splice(i, 1)
break
}
}
}
} else {
for (let i = 0, len = this.store.instances.length; i < len; i++) {
if (this.store.instances[i] === this) {
this.store.instances.splice(i, 1)
break
}
}
}
}
}