peryl 1.5.21 → 1.5.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/demo/hash_demo.ts +6 -1
- package/demo/hsml-appel_demo.html +1 -1
- package/demo/hsml-appel_demo.ts +14 -10
- package/dist/browser-esmodule/hash.js +2 -2
- package/dist/browser-esmodule/hash.js.map +1 -1
- package/dist/browser-esmodule/hsml-app.js +24 -25
- package/dist/browser-esmodule/hsml-app.js.map +1 -1
- package/dist/browser-esmodule/index.js +26 -27
- package/dist/browser-esmodule/index.js.map +1 -1
- package/dist/browser-umd/hash.js +1 -1
- package/dist/browser-umd/hash.js.map +1 -1
- package/dist/browser-umd/hsml-app.js +1 -1
- package/dist/browser-umd/hsml-app.js.map +1 -1
- package/dist/browser-umd/index.js +1 -1
- package/dist/browser-umd/index.js.map +1 -1
- package/dist/demo/{hash_demo.1cbbc47a.js → hash_demo.57b93f2a.js} +2 -2
- package/dist/demo/hash_demo.57b93f2a.js.map +1 -0
- package/dist/demo/{hash_demo.80f80384.js → hash_demo.7e0ef005.js} +2 -2
- package/dist/demo/hash_demo.7e0ef005.js.map +1 -0
- package/dist/demo/hash_demo.html +1 -1
- package/dist/demo/hsml-app-bysquare_demo.html +1 -1
- package/dist/demo/hsml-app-form-validation_demo.html +1 -1
- package/dist/demo/hsml-app-form_demo.html +1 -1
- package/dist/demo/hsml-app-test_demo.html +1 -1
- package/dist/demo/hsml-app-tictactoe_demo.html +1 -1
- package/dist/demo/hsml-app_demo.html +1 -1
- package/dist/demo/hsml-appel_demo.39c5c95a.js +2 -0
- package/dist/demo/hsml-appel_demo.39c5c95a.js.map +1 -0
- package/dist/demo/hsml-appel_demo.fd0c6348.js +2 -0
- package/dist/demo/hsml-appel_demo.fd0c6348.js.map +1 -0
- package/dist/demo/hsml-appel_demo.html +1 -1
- package/dist/demo/hsml-appi_demo.64f70501.js +2 -0
- package/dist/demo/hsml-appi_demo.64f70501.js.map +1 -0
- package/dist/demo/hsml-appi_demo.9a157181.js +2 -0
- package/dist/demo/hsml-appi_demo.9a157181.js.map +1 -0
- package/dist/demo/hsml-appi_demo.html +1 -1
- package/dist/hash.d.ts +2 -2
- package/dist/hash.js +2 -2
- package/dist/hash.js.map +1 -1
- package/dist/hsml-app.d.ts +8 -8
- package/dist/hsml-app.js +44 -37
- package/dist/hsml-app.js.map +1 -1
- package/package.json +1 -1
- package/src/hash.ts +4 -5
- package/src/hsml-app.ts +92 -67
- package/dist/browser-esmodule/google-analytics.js +0 -50
- package/dist/browser-esmodule/google-analytics.js.map +0 -1
- package/dist/browser-umd/google-analytics.js +0 -2
- package/dist/browser-umd/google-analytics.js.map +0 -1
- package/dist/demo/hash_demo.1cbbc47a.js.map +0 -1
- package/dist/demo/hash_demo.80f80384.js.map +0 -1
- package/dist/demo/hsml-appel_demo.1da052b6.js +0 -2
- package/dist/demo/hsml-appel_demo.1da052b6.js.map +0 -1
- package/dist/demo/hsml-appel_demo.7fcc74a6.js +0 -2
- package/dist/demo/hsml-appel_demo.7fcc74a6.js.map +0 -1
- package/dist/demo/hsml-appi_demo.3d3d0e4e.js +0 -2
- package/dist/demo/hsml-appi_demo.3d3d0e4e.js.map +0 -1
- package/dist/demo/hsml-appi_demo.eac28520.js +0 -2
- package/dist/demo/hsml-appi_demo.eac28520.js.map +0 -1
- package/dist/google-analytics.d.ts +0 -21
- package/dist/google-analytics.js +0 -63
- package/dist/google-analytics.js.map +0 -1
- package/src/google-analytics.ts +0 -79
package/demo/hash_demo.ts
CHANGED
|
@@ -11,6 +11,8 @@ interface Query {
|
|
|
11
11
|
b: string;
|
|
12
12
|
c: string;
|
|
13
13
|
time: string;
|
|
14
|
+
u?: string;
|
|
15
|
+
n?: string;
|
|
14
16
|
}
|
|
15
17
|
|
|
16
18
|
const h = new hash.Hash<hash.HashUrlData<keyof Query>>(emitWritten)
|
|
@@ -23,7 +25,10 @@ const h = new hash.Hash<hash.HashUrlData<keyof Query>>(emitWritten)
|
|
|
23
25
|
.listen()
|
|
24
26
|
// .write("hello");
|
|
25
27
|
// .write({ message: "hello" });
|
|
26
|
-
.write({
|
|
28
|
+
.write({
|
|
29
|
+
path: ["hello", "peter"],
|
|
30
|
+
query: { a: "a?a", b: "b&b", c: " .%", u: undefined, n: null }
|
|
31
|
+
});
|
|
27
32
|
|
|
28
33
|
(self as any).h = h;
|
|
29
34
|
|
package/demo/hsml-appel_demo.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { HAction, HAppActions, happel, HDispatch, HDispatcher, HDispatchScopes, HState, HView } from "../src/hsml-app";
|
|
1
|
+
import { HAction, HAppActions, happel, HDispatcher, HDispatchScopes, HState, HView } from "../src/hsml-app";
|
|
3
2
|
|
|
4
3
|
interface CounterState {
|
|
5
4
|
count: number;
|
|
@@ -30,7 +29,7 @@ const counterView: HView<CounterState, CounterActions> = function (state) {
|
|
|
30
29
|
};
|
|
31
30
|
|
|
32
31
|
const counterDispatcher: HDispatcher<CounterState, CounterActions> = async function (action, state, dispatch) {
|
|
33
|
-
console.log("action counter:", action);
|
|
32
|
+
// console.log("action counter:", action);
|
|
34
33
|
// console.log("state counter:", state);
|
|
35
34
|
// console.log("happ counter:", this);
|
|
36
35
|
|
|
@@ -63,8 +62,8 @@ happel<CounterState, CounterActions>({
|
|
|
63
62
|
state: counterState,
|
|
64
63
|
view: counterView,
|
|
65
64
|
dispatcher: counterDispatcher,
|
|
66
|
-
|
|
67
|
-
attributes: ["count"],
|
|
65
|
+
id: "happ-counter",
|
|
66
|
+
// attributes: ["count"],
|
|
68
67
|
debug: true
|
|
69
68
|
});
|
|
70
69
|
|
|
@@ -79,7 +78,7 @@ enum AppActions {
|
|
|
79
78
|
|
|
80
79
|
const appState: HState<AppState> = function () {
|
|
81
80
|
return {
|
|
82
|
-
count:
|
|
81
|
+
count: 33
|
|
83
82
|
}
|
|
84
83
|
};
|
|
85
84
|
|
|
@@ -87,18 +86,23 @@ const appView: HView<AppState, AppActions> = function (state) {
|
|
|
87
86
|
return [
|
|
88
87
|
["h2", ["App count: ", state.count]],
|
|
89
88
|
["happ-counter", {
|
|
90
|
-
count:
|
|
89
|
+
count: state.count,
|
|
91
90
|
on: [HAppActions.action, AppActions.action]
|
|
92
91
|
}]
|
|
93
92
|
];
|
|
94
93
|
};
|
|
95
94
|
|
|
96
95
|
const appDispatcher: HDispatcher<AppState, AppActions | CounterActions> = async function (action, state, dispatch) {
|
|
97
|
-
console.log("action:", action);
|
|
96
|
+
// console.log("action:", action);
|
|
98
97
|
// console.log("state:", state);
|
|
99
98
|
// console.log("happ:", this);
|
|
100
99
|
|
|
101
100
|
switch (action.type) {
|
|
101
|
+
case HAppActions.attribute:
|
|
102
|
+
if (action.data.attrName === "count") {
|
|
103
|
+
state.count = Number(action.data.newVal);
|
|
104
|
+
}
|
|
105
|
+
break;
|
|
102
106
|
case AppActions.action:
|
|
103
107
|
const a = action.data as HAction<AppActions | CounterActions>;
|
|
104
108
|
switch (a.type) {
|
|
@@ -118,7 +122,7 @@ happel<AppState, AppActions | CounterActions>({
|
|
|
118
122
|
state: appState,
|
|
119
123
|
view: appView,
|
|
120
124
|
dispatcher: appDispatcher,
|
|
121
|
-
|
|
122
|
-
attributes: [],
|
|
125
|
+
id: "happ-app",
|
|
126
|
+
// attributes: [],
|
|
123
127
|
debug: true
|
|
124
128
|
});
|
|
@@ -15,7 +15,7 @@ const $b951870b67fa90fa$export$baec1e6ad0617c4b = (data)=>{
|
|
|
15
15
|
const d = typeof data === "string" ? $b951870b67fa90fa$export$74e860f5d1acb08f(data) : data;
|
|
16
16
|
const dpath = (_a = d.path) !== null && _a !== void 0 ? _a : [];
|
|
17
17
|
const dquery = (_b = d.query) !== null && _b !== void 0 ? _b : {};
|
|
18
|
-
const path = dpath.map((p)=>encodeURIComponent(p)).join("/");
|
|
18
|
+
const path = dpath.map((p)=>encodeURIComponent(p !== null && p !== void 0 ? p : "")).join("/");
|
|
19
19
|
const query = Object.entries(dquery).reduce((p, c)=>{
|
|
20
20
|
if (typeof c[1] === "string") p.append(c[0], c[1]);
|
|
21
21
|
else if (c[1] && typeof c[1].length === "number") c[1].forEach((v)=>p.append(c[0], v));
|
|
@@ -76,7 +76,7 @@ class $b951870b67fa90fa$export$ab85ecd77ce6a5cd {
|
|
|
76
76
|
return this._decode(location.hash.slice(1));
|
|
77
77
|
}
|
|
78
78
|
write(data) {
|
|
79
|
-
location.hash =
|
|
79
|
+
location.hash = this._encode(data);
|
|
80
80
|
if (!this._emitWritten) {
|
|
81
81
|
this._writtenDataJson = JSON.stringify(data);
|
|
82
82
|
this._cb && this._cb(data);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;AAQO,MAAM,4CAAiB,CAAC,OAAc,OAAO,mBAAmB,KAAK,SAAS,CAAC,SAAS,EAAE;AAC1F,MAAM,4CAAiB,CAAC,MAAgB,MAAM,KAAK,KAAK,CAAC,mBAAmB,QAAQ,SAAS;AAE7F,MAAM,4CAAgB,CAAoC,OAAjE;I,I,I;IAEI,MAAM,IAAI,OAAO,SAAS,WACpB,0CAAc,QACd,IAAmB;IACzB,MAAM,QAAQ,AAAA,CAAA,KAAA,EAAE,IAAI,AAAJ,MAAI,IAAA,IAAA,OAAA,KAAA,IAAA,KAAI,EAAE;IAC1B,MAAM,SAAS,AAAA,CAAA,KAAA,EAAE,KAAK,AAAL,MAAK,IAAA,IAAA,OAAA,KAAA,IAAA,KAAI,CAAA,CAAE;IAC5B,MAAM,OAAO,MAAM,GAAG,CAAC,CAAA,IAAK,mBAAmB,
|
|
1
|
+
{"mappings":";;;;;;;;;;AAQO,MAAM,4CAAiB,CAAC,OAAc,OAAO,mBAAmB,KAAK,SAAS,CAAC,SAAS,EAAE;AAC1F,MAAM,4CAAiB,CAAC,MAAgB,MAAM,KAAK,KAAK,CAAC,mBAAmB,QAAQ,SAAS;AAE7F,MAAM,4CAAgB,CAAoC,OAAjE;I,I,I;IAEI,MAAM,IAAI,OAAO,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C,YAAY,EAAE;YACpB,IAAI,CAAC,gBAAgB,GAAG,KAAK,SAAS,CAAC;YACvC,IAAI,CAAC,GAAG,IAAI,IAAI,CAAC,GAAG,CAAC;QACxB,CAAA;QACD,OAAO,IAAI;IACf;AAEH","sources":["src/hash.ts"],"sourcesContent":["\nexport interface HashUrlData <QueryKeys extends string = string> {\n path: (string | undefined | null)[];\n query: {\n [key in QueryKeys]?: string | string[] | undefined | null;\n };\n}\n\nexport const hashJsonEncode = (data: any) => data ? encodeURIComponent(JSON.stringify(data)) : \"\";\nexport const hashJsonDecode = (str: string) => str ? JSON.parse(decodeURIComponent(str)) : undefined;\n\nexport const hashUrlEncode = <QueryKeys extends string = string>(data: HashUrlData<QueryKeys>): string => {\n // console.log(data);\n const d = typeof data === \"string\"\n ? hashUrlDecode(data)\n : data as HashUrlData;\n const dpath = d.path ?? [];\n const dquery = d.query ?? {};\n const path = dpath.map(p => encodeURIComponent(p ?? \"\")).join(\"/\");\n // const params = new URLSearchParams();\n const query = Object.entries(dquery)\n .reduce(\n (p, c) => {\n if (typeof c[1] === \"string\") {\n p.append(c[0], c[1]);\n } else if (c[1] && typeof c[1].length === \"number\") {\n (c[1] as Array<any>).forEach(v => p.append(c[0], v));\n }\n return p;\n },\n new URLSearchParams())\n .toString();\n const str = `${path}${query ? \"?\" : \"\"}${query}`;\n // console.log(str);\n return str;\n};\n\nexport const hashUrlDecode = <QueryKeys extends string = string>(str: string): HashUrlData<QueryKeys> => {\n // console.log(str);\n const [pathStr, queryStr] = str.split(\"?\");\n // const pathStr = str.substring(0, str.indexOf(\"?\"));\n // const queryStr = str.substring(str.indexOf(\"?\") + 1);\n const path = pathStr.split(\"/\").map(p => decodeURIComponent(p));\n const query = {} as any;\n for (const e of new URLSearchParams(queryStr).entries()) {\n const [k, v] = e;\n if (k in query) {\n if (typeof query[k] === \"string\") {\n query[k] = [query[k], v];\n } else {\n query[k].push(v);\n }\n } else {\n query[k] = v;\n }\n }\n const data = { path, query };\n // console.log(data);\n return data;\n};\n\nexport class Hash<T = string> {\n\n private _cb?: (data: T) => void;\n\n private _emitWritten: boolean;\n private _writtenDataJson?: string;\n\n private _encode = (data: T) => String(data);\n private _decode = (str: string) => str as any as T;\n\n constructor(emitWritten = true) {\n this._emitWritten = emitWritten;\n }\n\n onChange(cb: (data: T) => void): this {\n this._cb = cb;\n return this;\n }\n\n coders(encode: (data: T) => string,\n decode: (data: string) => T): this {\n this._encode = encode;\n this._decode = decode;\n return this;\n }\n\n listen(): this {\n this._cb && this._cb(this.read());\n if (\"onhashchange\" in window) {\n onhashchange = () => {\n const data = this.read();\n // console.log(\"onhashchange\", location.hash, data);\n if (!this._emitWritten) {\n const written = this._writtenDataJson === JSON.stringify(data);\n this._writtenDataJson = undefined;\n if (!written) {\n this._cb && this._cb(data);\n }\n } else {\n this._cb && this._cb(data);\n }\n };\n } else {\n alert(`Browser \"window.onhashchange\" not implemented`);\n // let prevHash = location.hash;\n // if (this._iId) {\n // clearInterval(this._iId);\n // }\n // this._iId = setInterval(() => {\n // if (location.hash !== prevHash) {\n // prevHash = location.hash;\n // const written = this._dataJson === location.hash;\n // this._dataJson = undefined;\n // if (this._emitWritten || !written) {\n // this._cb && this._cb(data);\n // }\n // }\n // }, 500);\n }\n return this;\n }\n\n read(): T {\n return this._decode(location.hash.slice(1));\n }\n\n write(data: T): this {\n location.hash = this._encode(data);\n if (!this._emitWritten) {\n this._writtenDataJson = JSON.stringify(data);\n this._cb && this._cb(data);\n }\n return this;\n }\n\n}\n"],"names":[],"version":3,"file":"hash.js.map"}
|
|
@@ -998,16 +998,18 @@ const $9adf8bc2f1ba310f$var$msgRender = "render:";
|
|
|
998
998
|
const $9adf8bc2f1ba310f$var$msgUpdate = "update:";
|
|
999
999
|
const $9adf8bc2f1ba310f$var$HAPP = "happ";
|
|
1000
1000
|
function $9adf8bc2f1ba310f$export$eb8950696418f795(hAppI) {
|
|
1001
|
-
return new $9adf8bc2f1ba310f$export$8cfef5dc37c46888(hAppI.state, hAppI.view, hAppI.dispatcher, hAppI.element, hAppI.debug, hAppI.
|
|
1001
|
+
return new $9adf8bc2f1ba310f$export$8cfef5dc37c46888(hAppI.state, hAppI.view, hAppI.dispatcher, hAppI.element, hAppI.debug, hAppI.id);
|
|
1002
1002
|
}
|
|
1003
1003
|
function $9adf8bc2f1ba310f$export$1cfc54b3834d3c50(hAppI) {
|
|
1004
|
-
customElements.define(
|
|
1004
|
+
if (!customElements.get(hAppI.id)) customElements.define(hAppI.id, class HAppElement extends HTMLElement {
|
|
1005
1005
|
static get observedAttributes() {
|
|
1006
|
-
|
|
1006
|
+
var _a;
|
|
1007
|
+
const state = hAppI.state();
|
|
1008
|
+
return ((_a = hAppI.attributes) !== null && _a !== void 0 ? _a : typeof state === "object") ? Object.keys(state) : [];
|
|
1007
1009
|
}
|
|
1008
1010
|
constructor(){
|
|
1009
1011
|
super();
|
|
1010
|
-
this._happel = new $9adf8bc2f1ba310f$export$8cfef5dc37c46888(hAppI.state, hAppI.view, hAppI.dispatcher, undefined, hAppI.debug, hAppI.
|
|
1012
|
+
this._happel = new $9adf8bc2f1ba310f$export$8cfef5dc37c46888(hAppI.state, hAppI.view, hAppI.dispatcher, undefined, hAppI.debug, hAppI.id);
|
|
1011
1013
|
this._happel.customElement = this;
|
|
1012
1014
|
}
|
|
1013
1015
|
connectedCallback() {
|
|
@@ -1032,7 +1034,7 @@ function $9adf8bc2f1ba310f$export$1cfc54b3834d3c50(hAppI) {
|
|
|
1032
1034
|
});
|
|
1033
1035
|
}
|
|
1034
1036
|
class $9adf8bc2f1ba310f$export$8cfef5dc37c46888 {
|
|
1035
|
-
constructor(state, view, dispatcher, element, debug,
|
|
1037
|
+
constructor(state, view, dispatcher, element, debug, id){
|
|
1036
1038
|
this.refs = {};
|
|
1037
1039
|
this.dispatch = (type, data, scope)=>$9adf8bc2f1ba310f$var$__awaiter(this, void 0, void 0, function*() {
|
|
1038
1040
|
return this._dispatchAction(type, data, undefined, scope);
|
|
@@ -1044,17 +1046,17 @@ class $9adf8bc2f1ba310f$export$8cfef5dc37c46888 {
|
|
|
1044
1046
|
try {
|
|
1045
1047
|
hsmls = this.view(this.state);
|
|
1046
1048
|
} catch (e) {
|
|
1047
|
-
$9adf8bc2f1ba310f$export$8cfef5dc37c46888.error(this.
|
|
1049
|
+
$9adf8bc2f1ba310f$export$8cfef5dc37c46888.error(this.id, $9adf8bc2f1ba310f$var$msgRender, e);
|
|
1048
1050
|
}
|
|
1049
1051
|
const t1 = performance.now();
|
|
1050
|
-
$9adf8bc2f1ba310f$export$8cfef5dc37c46888.log(this.
|
|
1052
|
+
$9adf8bc2f1ba310f$export$8cfef5dc37c46888.log(this.id, $9adf8bc2f1ba310f$var$msgRender, `${t1 - t0} ms`, hsmls);
|
|
1051
1053
|
return hsmls !== null && hsmls !== void 0 ? hsmls : [];
|
|
1052
1054
|
} else {
|
|
1053
1055
|
let hsmls;
|
|
1054
1056
|
try {
|
|
1055
1057
|
hsmls = this.view(this.state);
|
|
1056
1058
|
} catch (e) {
|
|
1057
|
-
$9adf8bc2f1ba310f$export$8cfef5dc37c46888.error(this.
|
|
1059
|
+
$9adf8bc2f1ba310f$export$8cfef5dc37c46888.error(this.id, $9adf8bc2f1ba310f$var$msgRender, e);
|
|
1058
1060
|
}
|
|
1059
1061
|
return hsmls !== null && hsmls !== void 0 ? hsmls : [];
|
|
1060
1062
|
}
|
|
@@ -1136,20 +1138,19 @@ class $9adf8bc2f1ba310f$export$8cfef5dc37c46888 {
|
|
|
1136
1138
|
this.toHtml = ()=>{
|
|
1137
1139
|
return this.element ? this.element.outerHTML : "";
|
|
1138
1140
|
};
|
|
1141
|
+
this.id = id !== null && id !== void 0 ? id : $9adf8bc2f1ba310f$var$HAPP;
|
|
1139
1142
|
this.debug = debug !== null && debug !== void 0 ? debug : false;
|
|
1140
|
-
this.name = name !== null && name !== void 0 ? name : $9adf8bc2f1ba310f$var$HAPP;
|
|
1141
|
-
this.attributes = attributes !== null && attributes !== void 0 ? attributes : [];
|
|
1142
1143
|
this.state = state();
|
|
1143
1144
|
this.view = view;
|
|
1144
1145
|
this.dispatcher = dispatcher !== null && dispatcher !== void 0 ? dispatcher : (a)=>$9adf8bc2f1ba310f$var$__awaiter(this, void 0, void 0, function*() {
|
|
1145
|
-
return $9adf8bc2f1ba310f$export$8cfef5dc37c46888.log(this.
|
|
1146
|
+
return $9adf8bc2f1ba310f$export$8cfef5dc37c46888.log(this.id, $9adf8bc2f1ba310f$var$msgAction, a.type, a.data);
|
|
1146
1147
|
});
|
|
1147
1148
|
this._dispatchAction($9adf8bc2f1ba310f$export$3dcd9fad60135c2c.init, this).then(()=>element && this.mount(element));
|
|
1148
1149
|
}
|
|
1149
1150
|
_dispatchAction(type, data, event, scope) {
|
|
1150
1151
|
return $9adf8bc2f1ba310f$var$__awaiter(this, void 0, void 0, function*() {
|
|
1151
1152
|
if (this.debug) {
|
|
1152
|
-
$9adf8bc2f1ba310f$export$8cfef5dc37c46888.log(this.
|
|
1153
|
+
$9adf8bc2f1ba310f$export$8cfef5dc37c46888.log(this.id, $9adf8bc2f1ba310f$var$msgAction, {
|
|
1153
1154
|
type: type,
|
|
1154
1155
|
data: data,
|
|
1155
1156
|
event: event
|
|
@@ -1157,23 +1158,21 @@ class $9adf8bc2f1ba310f$export$8cfef5dc37c46888 {
|
|
|
1157
1158
|
const t0 = performance.now();
|
|
1158
1159
|
yield this._dispatch(type, data, event, scope);
|
|
1159
1160
|
const t1 = performance.now();
|
|
1160
|
-
$9adf8bc2f1ba310f$export$8cfef5dc37c46888.log(this.
|
|
1161
|
+
$9adf8bc2f1ba310f$export$8cfef5dc37c46888.log(this.id, $9adf8bc2f1ba310f$var$msgDispatch, `${t1 - t0} ms`, this.state);
|
|
1161
1162
|
} else yield this._dispatch(type, data, event, scope);
|
|
1162
1163
|
});
|
|
1163
1164
|
}
|
|
1164
1165
|
_dispatch(type, data, event, scope) {
|
|
1165
1166
|
return $9adf8bc2f1ba310f$var$__awaiter(this, void 0, void 0, function*() {
|
|
1166
|
-
if (!scope) {
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
}
|
|
1176
|
-
this.update();
|
|
1167
|
+
if (!scope) try {
|
|
1168
|
+
const skipUpdate = yield this.dispatcher({
|
|
1169
|
+
type: type,
|
|
1170
|
+
data: data,
|
|
1171
|
+
event: event
|
|
1172
|
+
}, this.state, this.dispatch);
|
|
1173
|
+
if (!skipUpdate) this.update();
|
|
1174
|
+
} catch (e) {
|
|
1175
|
+
$9adf8bc2f1ba310f$export$8cfef5dc37c46888.error(this.id, $9adf8bc2f1ba310f$var$msgDispatch, e);
|
|
1177
1176
|
}
|
|
1178
1177
|
scope === "element" && this._dispatchElement(type, data);
|
|
1179
1178
|
scope === "window" && this._dispatchWindow(type, data);
|
|
@@ -1215,7 +1214,7 @@ class $9adf8bc2f1ba310f$export$8cfef5dc37c46888 {
|
|
|
1215
1214
|
const t0 = performance.now();
|
|
1216
1215
|
(0, $32c8c7b45dace799$export$ccb3a8beff05eea9)(el, hsml, ctx);
|
|
1217
1216
|
const t1 = performance.now();
|
|
1218
|
-
$9adf8bc2f1ba310f$export$8cfef5dc37c46888.log(this.
|
|
1217
|
+
$9adf8bc2f1ba310f$export$8cfef5dc37c46888.log(this.id, $9adf8bc2f1ba310f$var$msgUpdate, `${t1 - t0} ms`, el);
|
|
1219
1218
|
} else (0, $32c8c7b45dace799$export$ccb3a8beff05eea9)(el, hsml, ctx);
|
|
1220
1219
|
}
|
|
1221
1220
|
}
|