build
This commit is contained in:
parent
a2d7b9fc20
commit
68a5e2a06a
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* omi v4.0.1 http://omijs.org
|
||||
* omi v4.0.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
|
||||
|
@ -34,8 +34,6 @@
|
|||
*/
|
||||
var options = {
|
||||
|
||||
store: null,
|
||||
|
||||
root: getGlobal()
|
||||
//componentChange(component, element) { },
|
||||
/** If `true`, `prop` changes trigger synchronous component updates.
|
||||
|
@ -673,10 +671,17 @@
|
|||
}
|
||||
|
||||
WeElement.prototype.connectedCallback = function connectedCallback() {
|
||||
this.store = options.store;
|
||||
if (this.store) {
|
||||
this.store.instances.push(this);
|
||||
if (!this.constructor.pure) {
|
||||
var p = this.parentNode;
|
||||
while (p && !this.store) {
|
||||
this.store = p.store;
|
||||
p = p.parentNode || p.host;
|
||||
}
|
||||
if (this.store) {
|
||||
this.store.instances.push(this);
|
||||
}
|
||||
}
|
||||
|
||||
this.install();
|
||||
|
||||
var shadowRoot = this.attachShadow({ mode: 'open' });
|
||||
|
@ -825,23 +830,30 @@
|
|||
return Object.prototype.toString.call(obj);
|
||||
}
|
||||
|
||||
var list = [];
|
||||
var tick = false;
|
||||
|
||||
function render(vnode, parent, store) {
|
||||
parent = typeof parent === 'string' ? document.querySelector(parent) : parent;
|
||||
if (store) {
|
||||
store.instances = [];
|
||||
extendStoreUpate(store);
|
||||
options.store = store;
|
||||
store.originData = JSON.parse(JSON.stringify(store.data));
|
||||
}
|
||||
parent.store = store;
|
||||
diff(null, vnode, {}, false, parent, false);
|
||||
list.push(store);
|
||||
|
||||
if (store) {
|
||||
if (store && !tick) {
|
||||
requestIdleCallback(execTask);
|
||||
tick = true;
|
||||
}
|
||||
|
||||
function execTask(deadline) {
|
||||
while (deadline.timeRemaining() > 0) {
|
||||
store.update();
|
||||
list.forEach(function (currentStore) {
|
||||
currentStore.update();
|
||||
});
|
||||
}
|
||||
setTimeout(function () {
|
||||
requestIdleCallback(execTask);
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* omi v4.0.1 http://omijs.org
|
||||
* omi v4.0.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
|
||||
|
@ -31,8 +31,6 @@ function getGlobal() {
|
|||
*/
|
||||
var options = {
|
||||
|
||||
store: null,
|
||||
|
||||
root: getGlobal()
|
||||
//componentChange(component, element) { },
|
||||
/** If `true`, `prop` changes trigger synchronous component updates.
|
||||
|
@ -670,10 +668,17 @@ var WeElement = function (_HTMLElement) {
|
|||
}
|
||||
|
||||
WeElement.prototype.connectedCallback = function connectedCallback() {
|
||||
this.store = options.store;
|
||||
if (this.store) {
|
||||
this.store.instances.push(this);
|
||||
if (!this.constructor.pure) {
|
||||
var p = this.parentNode;
|
||||
while (p && !this.store) {
|
||||
this.store = p.store;
|
||||
p = p.parentNode || p.host;
|
||||
}
|
||||
if (this.store) {
|
||||
this.store.instances.push(this);
|
||||
}
|
||||
}
|
||||
|
||||
this.install();
|
||||
|
||||
var shadowRoot = this.attachShadow({ mode: 'open' });
|
||||
|
@ -822,23 +827,30 @@ function type(obj) {
|
|||
return Object.prototype.toString.call(obj);
|
||||
}
|
||||
|
||||
var list = [];
|
||||
var tick = false;
|
||||
|
||||
function render(vnode, parent, store) {
|
||||
parent = typeof parent === 'string' ? document.querySelector(parent) : parent;
|
||||
if (store) {
|
||||
store.instances = [];
|
||||
extendStoreUpate(store);
|
||||
options.store = store;
|
||||
store.originData = JSON.parse(JSON.stringify(store.data));
|
||||
}
|
||||
parent.store = store;
|
||||
diff(null, vnode, {}, false, parent, false);
|
||||
list.push(store);
|
||||
|
||||
if (store) {
|
||||
if (store && !tick) {
|
||||
requestIdleCallback(execTask);
|
||||
tick = true;
|
||||
}
|
||||
|
||||
function execTask(deadline) {
|
||||
while (deadline.timeRemaining() > 0) {
|
||||
store.update();
|
||||
list.forEach(function (currentStore) {
|
||||
currentStore.update();
|
||||
});
|
||||
}
|
||||
setTimeout(function () {
|
||||
requestIdleCallback(execTask);
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -281,7 +281,9 @@
|
|||
}
|
||||
function render(vnode, parent, store) {
|
||||
function execTask(deadline) {
|
||||
while (deadline.timeRemaining() > 0) store.update();
|
||||
while (deadline.timeRemaining() > 0) list.forEach(function(currentStore) {
|
||||
currentStore.update();
|
||||
});
|
||||
setTimeout(function() {
|
||||
requestIdleCallback(execTask);
|
||||
}, 200);
|
||||
|
@ -290,11 +292,15 @@
|
|||
if (store) {
|
||||
store.instances = [];
|
||||
extendStoreUpate(store);
|
||||
options.store = store;
|
||||
store.originData = JSON.parse(JSON.stringify(store.data));
|
||||
}
|
||||
parent.store = store;
|
||||
diff(null, vnode, {}, !1, parent, !1);
|
||||
if (store) requestIdleCallback(execTask);
|
||||
list.push(store);
|
||||
if (store && !tick) {
|
||||
requestIdleCallback(execTask);
|
||||
tick = !0;
|
||||
}
|
||||
}
|
||||
function extendStoreUpate(store) {
|
||||
store.update = function() {
|
||||
|
@ -377,7 +383,6 @@
|
|||
};
|
||||
}
|
||||
var options = {
|
||||
store: null,
|
||||
root: function() {
|
||||
if ('object' != typeof global || !global || global.Math !== Math || global.Array !== Array) {
|
||||
if ('undefined' != typeof self) return self; else if ('undefined' != typeof window) return window; else if ('undefined' != typeof global) return global;
|
||||
|
@ -430,8 +435,14 @@
|
|||
}
|
||||
_inherits(WeElement, _HTMLElement);
|
||||
WeElement.prototype.connectedCallback = function() {
|
||||
this.store = options.store;
|
||||
if (this.store) this.store.instances.push(this);
|
||||
if (!this.constructor.pure) {
|
||||
var p = this.parentNode;
|
||||
while (p && !this.store) {
|
||||
this.store = p.store;
|
||||
p = p.parentNode || p.host;
|
||||
}
|
||||
if (this.store) this.store.instances.push(this);
|
||||
}
|
||||
this.install();
|
||||
var shadowRoot = this.attachShadow({
|
||||
mode: 'open'
|
||||
|
@ -465,6 +476,8 @@
|
|||
WeElement.prototype.afterUpdate = function() {};
|
||||
return WeElement;
|
||||
}(HTMLElement);
|
||||
var list = [];
|
||||
var tick = !1;
|
||||
options.root.Omi = {
|
||||
tag: tag,
|
||||
WeElement: WeElement,
|
||||
|
|
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
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "omi",
|
||||
"version": "4.0.1",
|
||||
"version": "4.0.2",
|
||||
"description": "Next generation web framework.",
|
||||
"main": "dist/omi.js",
|
||||
"jsnext:main": "dist/omi.esm.js",
|
||||
|
|
Loading…
Reference in New Issue