cbvirtua 1.0.34 → 1.0.36

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.
Files changed (49) hide show
  1. package/package.json +1 -1
  2. package/queue.js +0 -1
  3. package/ske.txt +74 -0
  4. package/src/App.vue +38 -0
  5. package/src/assets/logo.png +0 -0
  6. package/src/components/HelloWorld.vue +37 -0
  7. package/src/components/cache.js +1 -0
  8. package/src/components/cache.vue +70 -0
  9. package/src/main.js +8 -0
  10. package/after/after.d.ts +0 -3
  11. package/after/after.index.d.ts +0 -3
  12. package/after/after.index.js +0 -3
  13. package/after/after.index.js.map +0 -1
  14. package/after/after.js +0 -11
  15. package/after/after.js.map +0 -1
  16. package/after/after.model.d.ts +0 -9
  17. package/after/after.model.js +0 -2
  18. package/after/after.model.js.map +0 -1
  19. package/after/after.spec.d.ts +0 -1
  20. package/after/after.spec.js +0 -226
  21. package/after/after.spec.js.map +0 -1
  22. package/after/afterify.d.ts +0 -3
  23. package/after/afterify.js +0 -26
  24. package/after/afterify.js.map +0 -1
  25. package/before/before.d.ts +0 -3
  26. package/before/before.index.d.ts +0 -3
  27. package/before/before.index.js +0 -3
  28. package/before/before.index.js.map +0 -1
  29. package/before/before.js +0 -11
  30. package/before/before.js.map +0 -1
  31. package/before/before.model.d.ts +0 -4
  32. package/before/before.model.js +0 -2
  33. package/before/before.model.js.map +0 -1
  34. package/before/before.spec.d.ts +0 -1
  35. package/before/before.spec.js +0 -174
  36. package/before/before.spec.js.map +0 -1
  37. package/before/beforify.d.ts +0 -3
  38. package/before/beforify.js +0 -18
  39. package/before/beforify.js.map +0 -1
  40. package/canvas.txt +0 -204
  41. package/font_dxr36lzujh/demo.css +0 -539
  42. package/font_dxr36lzujh/demo_index.html +0 -345
  43. package/font_dxr36lzujh/iconfont.css +0 -41
  44. package/font_dxr36lzujh/iconfont.js +0 -1
  45. package/font_dxr36lzujh/iconfont.json +0 -58
  46. package/font_dxr36lzujh/iconfont.ttf +0 -0
  47. package/i18n.js +0 -406
  48. package/locaiton.js +0 -64
  49. package/p2.js +0 -334
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cbvirtua",
3
- "version": "1.0.34",
3
+ "version": "1.0.36",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/queue.js CHANGED
@@ -123,4 +123,3 @@ class AsyncIterQueue {
123
123
  );
124
124
  }
125
125
 
126
- const data = { "pkgFlag": 0, "crc": 0, "errCode": 0, "dataPackage": { "hashFlag": 0, "business": "{\"data\":[{\"end\":true,\"pageNo\":1,\"pageSize\":10,\"pageId\":6941,\"pageTitle\":\"szyd页面\",\"pageType\":4,\"needExposure\":false,\"resultList\":[{\"templateId\":41199,\"templateType\":\"cb-cube-mp-red-equity-2column-layout1-new\",\"templateIndex\":2,\"templateData\":{\"elementList\":[{\"imgUrl\":\"https:\/\/imcs.citicbank.com\/cloud\/d582eb5660224d13bb33f3122ba8cb7f.jpg?width=654&height=160\",\"eid\":\"79499\",\"pitNum\":\"1\",\"jumpData\":{\"jumpType\":\"url\",\"jumpName\":\"\",\"jumpParams\":{\"needLogin\":true,\"urlTargetType\":\"urlInMiniProgram\"},\"jumpUrl\":\"https:\/\/mp.weixin.qq.com\/s\/1YpZ5KNBQyYCjhx_ViIhOA\"},\"busOrgCode\":\"11111111\",\"style\":{\"marginRight\":\"\",\"borderRadius\":\"\",\"width\":\"327px\",\"marginBottom\":\"\",\"marginTop\":\"\",\"height\":\"80px\",\"marginLeft\":\"16px\"},\"eleCrowdTag\":\"\",\"pitOrderNum\":\"1\"}]},\"hasError\":false,\"globalConfig\":{\"style\":{\"marginRight\":\"8px\",\"paddingBottom\":\"\",\"borderRadius\":\"12px\",\"background\":\"#FFFFFF\",\"paddingRight\":\"\",\"marginBottom\":\"\",\"paddingTop\":\"\",\"paddingLeft\":\"\",\"marginTop\":\"\",\"marginLeft\":\"8px\"},\"title\":{\"leftTitle\":{\"style\":{\"color\":\"#34323F\",\"fontSize\":\"15px\",\"fontWeight\":\"500\",\"marginLeft\":\"16px\"},\"text\":\"全部权益\"},\"rightTitle\":{\"jumpData\":{\"jumpType\":\"noJump\",\"jumpParams\":\"\",\"jumpUrl\":\"\"},\"style\":{\"marginRight\":\"12px\",\"color\":\"#A9A9B9\",\"fontSize\":\"11px\",\"fontWeight\":\"400\"},\"text\":\"\"},\"style\":{\"paddingRight\":\"\",\"marginLeft\":\"\",\"marginRight\":\"\",\"paddingBottom\":\"\",\"borderRadius\":\"\",\"background\":\"\",\"width\":\"327px\",\"marginBottom\":\"\",\"lineHeight\":\"50px\",\"paddingTop\":\"\",\"paddingLeft\":\"\",\"marginTop\":\"\",\"height\":\"50px\"}}}}],\"hasError\":false,\"definePageId\":\"szyd_11111111_6941\",\"requestPageId\":6941}],\"success\":true,\"RETCODE\":\"AAAAAAA\"}", "signatureFlag": 0, "cryptFlag": 0 }, "errMsg": "" }
package/ske.txt CHANGED
@@ -0,0 +1,74 @@
1
+ /**
2
+ * 网页空闲检测
3
+ * @param {() => void} callback 空闲时执行,即一定时长无操作时触发
4
+ * @param {number} [timeout=15] 时长,默认15s,单位:秒
5
+ * @param {boolean} [immediate=false] 是否立即开始,默认 false
6
+ * @returns
7
+ */
8
+ const onIdleDetection = (callback, timeout = 15, immediate = false) => {
9
+ let pageTimer;
10
+ let beginTime = 0;
11
+ const onClearTimer = () => {
12
+ pageTimer && clearTimeout(pageTimer);
13
+ pageTimer = undefined;
14
+ };
15
+ const onStartTimer = () => {
16
+ const currentTime = Date.now();
17
+ if (pageTimer && currentTime - beginTime < 100) {
18
+ return;
19
+ }
20
+
21
+ onClearTimer();
22
+ beginTime = currentTime;
23
+ pageTimer = setTimeout(() => {
24
+ callback();
25
+ }, timeout * 1000);
26
+ };
27
+
28
+ const onPageVisibility = () => {
29
+ // 页面显示状态改变时,移除延时器
30
+ onClearTimer();
31
+
32
+ if (document.visibilityState === 'visible') {
33
+ const currentTime = Date.now();
34
+ // 页面显示时,计算时间,如果超出限制时间则直接执行回调函数
35
+ if (currentTime - beginTime >= timeout * 1000) {
36
+ callback();
37
+ return;
38
+ }
39
+ // 继续计时
40
+ pageTimer = setTimeout(() => {
41
+ callback();
42
+ }, timeout * 1000 - (currentTime - beginTime));
43
+ }
44
+ };
45
+
46
+ const startDetection = () => {
47
+ onStartTimer();
48
+ document.addEventListener('keydown', onStartTimer);
49
+ document.addEventListener('mousemove', onStartTimer);
50
+ document.addEventListener('visibilitychange', onPageVisibility);
51
+ };
52
+
53
+ const stopDetection = () => {
54
+ onClearTimer();
55
+ document.removeEventListener('keydown', onStartTimer);
56
+ document.removeEventListener('mousemove', onStartTimer);
57
+ document.removeEventListener('visibilitychange', onPageVisibility);
58
+ };
59
+
60
+ const restartDetection = () => {
61
+ onClearTimer();
62
+ onStartTimer();
63
+ };
64
+
65
+ if (immediate) {
66
+ startDetection();
67
+ }
68
+
69
+ return {
70
+ startDetection,
71
+ stopDetection,
72
+ restartDetection
73
+ };
74
+ };
package/src/App.vue ADDED
@@ -0,0 +1,38 @@
1
+ <template>
2
+ <div id="app">
3
+ <div @click="show = !show" style="border:1px solid #f0f;">测试</div>
4
+ <HelloWorld msg="Welcome to Your Vue.js App" />
5
+ <vCahe v-if="show">
6
+ <HelloWorld msg="Welcome to Your Vue.js App" />
7
+ </vCahe>
8
+ </div>
9
+ </template>
10
+
11
+ <script>
12
+ import HelloWorld from './components/HelloWorld.vue'
13
+ import vCahe from './components/cache.vue'
14
+
15
+ export default {
16
+ name: 'App',
17
+ data() {
18
+ return {
19
+ show: true
20
+ }
21
+ },
22
+ components: {
23
+ HelloWorld,
24
+ vCahe
25
+ }
26
+ }
27
+ </script>
28
+
29
+ <style>
30
+ #app {
31
+ font-family: Avenir, Helvetica, Arial, sans-serif;
32
+ -webkit-font-smoothing: antialiased;
33
+ -moz-osx-font-smoothing: grayscale;
34
+ text-align: center;
35
+ color: #2c3e50;
36
+ margin-top: 60px;
37
+ }
38
+ </style>
Binary file
@@ -0,0 +1,37 @@
1
+ <template>
2
+ <div class="hello">
3
+ <input type="text" v-model="name">
4
+ </div>
5
+ </template>
6
+
7
+ <script>
8
+ export default {
9
+ name: 'HelloWorld',
10
+ data() {
11
+ return {
12
+ name: 123
13
+ }
14
+ }
15
+ }
16
+ </script>
17
+
18
+ <!-- Add "scoped" attribute to limit CSS to this component only -->
19
+ <style scoped>
20
+ h3 {
21
+ margin: 40px 0 0;
22
+ }
23
+
24
+ ul {
25
+ list-style-type: none;
26
+ padding: 0;
27
+ }
28
+
29
+ li {
30
+ display: inline-block;
31
+ margin: 0 10px;
32
+ }
33
+
34
+ a {
35
+ color: #42b983;
36
+ }
37
+ </style>
@@ -0,0 +1 @@
1
+ export default {}
@@ -0,0 +1,70 @@
1
+ <script>
2
+ function getComponentName(opts) {
3
+ return opts && (opts.Ctor.options.name || opts.tag)
4
+ }
5
+
6
+ function isDef(v) {
7
+ return v !== undefined && v !== null
8
+ }
9
+
10
+ function isAsyncPlaceholder(node) {
11
+ return node.isComment && node.asyncFactory
12
+ }
13
+
14
+ function getFirstComponentChild(children) {
15
+ if (Array.isArray(children)) {
16
+ for (let i = 0; i < children.length; i++) {
17
+ const c = children[i]
18
+ if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
19
+ return c
20
+ }
21
+ }
22
+ }
23
+ }
24
+ import cache from './cache'
25
+ export default {
26
+ name: 'v-cache',
27
+ abstract: true,
28
+
29
+ props: {
30
+ cacheKey: {
31
+ type: String,
32
+ required: true
33
+ }
34
+ },
35
+
36
+ data() {
37
+ return {
38
+ }
39
+ },
40
+
41
+ render() {
42
+ const slot = this.$slots.default
43
+ const vnode = getFirstComponentChild(slot)
44
+ const componentOptions = vnode && vnode.componentOptions
45
+
46
+ if (componentOptions) {
47
+ const name = getComponentName(componentOptions)
48
+ const { cacheKey } = this
49
+ const key = name + cacheKey
50
+
51
+ vnode.key = key
52
+
53
+ if (cache[key]) {
54
+ vnode.componentInstance = cache[key].componentInstance
55
+ } else {
56
+ cache[key] = vnode
57
+ }
58
+
59
+ vnode.data.keepAlive = true
60
+ }
61
+ return vnode || (slot && slot[0])
62
+ },
63
+
64
+ destroyed() {
65
+ // Object.values(cache).forEach(vnode => {
66
+ // vnode.componentInstance.$destroy()
67
+ // })
68
+ }
69
+ }
70
+ </script>
package/src/main.js ADDED
@@ -0,0 +1,8 @@
1
+ import Vue from 'vue'
2
+ import App from './App.vue'
3
+
4
+ Vue.config.productionTip = false
5
+
6
+ new Vue({
7
+ render: h => h(App),
8
+ }).$mount('#app')
package/after/after.d.ts DELETED
@@ -1,3 +0,0 @@
1
- import { AfterConfig } from './after.model';
2
- import { Decorator } from '../common/model/common.model';
3
- export declare function after<T = any, D = any>(config: AfterConfig<T, D>): Decorator<T>;
@@ -1,3 +0,0 @@
1
- export { after } from './after';
2
- export { afterify } from './afterify';
3
- export { AfterFunc, AfterConfig, AfterParams } from './after.model';
@@ -1,3 +0,0 @@
1
- export { after } from './after';
2
- export { afterify } from './afterify';
3
- //# sourceMappingURL=after.index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"after.index.js","sourceRoot":"","sources":["../../../src/after/after.index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC"}
package/after/after.js DELETED
@@ -1,11 +0,0 @@
1
- import { afterify } from './afterify';
2
- export function after(config) {
3
- return (target, propertyName, descriptor) => {
4
- if (descriptor.value) {
5
- descriptor.value = afterify(descriptor.value, config);
6
- return descriptor;
7
- }
8
- throw new Error('@after is applicable only on a methods.');
9
- };
10
- }
11
- //# sourceMappingURL=after.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"after.js","sourceRoot":"","sources":["../../../src/after/after.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,MAAM,UAAU,KAAK,CAAmB,MAAyB;IAC/D,OAAO,CACL,MAAS,EACT,YAAqB,EACrB,UAAgD,EACZ,EAAE;QACtC,IAAI,UAAU,CAAC,KAAK,EAAE,CAAC;YACrB,UAAU,CAAC,KAAK,GAAG,QAAQ,CAAC,UAAU,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;YAEtD,OAAO,UAAU,CAAC;QACpB,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;IAC7D,CAAC,CAAC;AACJ,CAAC"}
@@ -1,9 +0,0 @@
1
- export type AfterFunc<D> = (x?: AfterParams<D>) => void;
2
- export interface AfterConfig<T = any, D = any> {
3
- func: AfterFunc<D> | keyof T;
4
- wait?: boolean;
5
- }
6
- export interface AfterParams<D = any> {
7
- args: any[];
8
- response: D;
9
- }
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=after.model.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"after.model.js","sourceRoot":"","sources":["../../../src/after/after.model.ts"],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- export {};
@@ -1,226 +0,0 @@
1
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
6
- };
7
- var __metadata = (this && this.__metadata) || function (k, v) {
8
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
- };
10
- import { after } from './after';
11
- describe('after', () => {
12
- it('should make sure error thrown when decorator not set on method', () => {
13
- try {
14
- const nonValidAfter = after({ func: null });
15
- class T {
16
- }
17
- __decorate([
18
- nonValidAfter,
19
- __metadata("design:type", String)
20
- ], T.prototype, "boo", void 0);
21
- }
22
- catch (e) {
23
- expect('@after is applicable only on a methods.').toBe(e.message);
24
- return;
25
- }
26
- throw new Error('should not reach this line');
27
- });
28
- it('should verify after method invocation with the right context when provided as string', () => {
29
- let counter = 0;
30
- class T {
31
- after() {
32
- expect(this.prop).toBe(3);
33
- expect(counter).toBe(1);
34
- }
35
- foo(x) {
36
- return this.goo(x);
37
- }
38
- goo(x) {
39
- expect(this.prop).toBe(3);
40
- expect(counter).toBe(0);
41
- counter += 1;
42
- }
43
- }
44
- __decorate([
45
- after({
46
- func: 'after',
47
- }),
48
- __metadata("design:type", Function),
49
- __metadata("design:paramtypes", [Number]),
50
- __metadata("design:returntype", void 0)
51
- ], T.prototype, "foo", null);
52
- const t = new T();
53
- t.prop = 3;
54
- const spyGoo = jest.spyOn(T.prototype, 'goo');
55
- const spyAfter = jest.spyOn(T.prototype, 'after');
56
- t.foo(1);
57
- expect(spyGoo).toBeCalledTimes(1);
58
- expect(spyGoo).toBeCalledWith(1);
59
- expect(spyAfter).toBeCalledTimes(1);
60
- });
61
- it('should verify after method invocation when method is provided', () => {
62
- let counter = 0;
63
- const afterFunc = jest.fn(() => {
64
- expect(counter).toBe(1);
65
- });
66
- class T {
67
- foo(x) {
68
- return this.goo(x);
69
- }
70
- goo(x) {
71
- expect(counter).toBe(0);
72
- counter += 1;
73
- }
74
- }
75
- __decorate([
76
- after({
77
- func: afterFunc,
78
- }),
79
- __metadata("design:type", Function),
80
- __metadata("design:paramtypes", [Number]),
81
- __metadata("design:returntype", void 0)
82
- ], T.prototype, "foo", null);
83
- const t = new T();
84
- const spyGoo = jest.spyOn(T.prototype, 'goo');
85
- t.foo(1);
86
- expect(spyGoo).toBeCalledTimes(1);
87
- expect(spyGoo).toBeCalledWith(1);
88
- expect(afterFunc.mock.calls.length).toBe(1);
89
- });
90
- it('should verify after method invocation when method is provided without waiting for it to be resolved', (done) => {
91
- let counter = 0;
92
- const afterFunc = jest.fn(() => {
93
- expect(counter).toBe(1);
94
- counter += 1;
95
- });
96
- class T {
97
- foo(x) {
98
- expect(counter).toBe(0);
99
- counter += 1;
100
- return new Promise((resolve) => {
101
- setTimeout(() => {
102
- expect(counter).toBe(2);
103
- resolve();
104
- done();
105
- }, 0);
106
- });
107
- }
108
- }
109
- __decorate([
110
- after({
111
- func: afterFunc,
112
- }),
113
- __metadata("design:type", Function),
114
- __metadata("design:paramtypes", [Number]),
115
- __metadata("design:returntype", Promise)
116
- ], T.prototype, "foo", null);
117
- const t = new T();
118
- t.foo(1);
119
- });
120
- it('should verify after method invocation when method is provided with waiting for it to be resolved', (done) => {
121
- let counter = 0;
122
- const afterFunc = jest.fn(() => {
123
- expect(counter).toBe(2);
124
- done();
125
- });
126
- class T {
127
- foo() {
128
- expect(counter).toBe(0);
129
- counter += 1;
130
- return new Promise((resolve) => {
131
- setTimeout(() => {
132
- expect(counter).toBe(1);
133
- counter += 1;
134
- resolve();
135
- }, 0);
136
- });
137
- }
138
- }
139
- __decorate([
140
- after({
141
- func: afterFunc,
142
- wait: true,
143
- }),
144
- __metadata("design:type", Function),
145
- __metadata("design:paramtypes", []),
146
- __metadata("design:returntype", Promise)
147
- ], T.prototype, "foo", null);
148
- const t = new T();
149
- t.foo();
150
- });
151
- it('should provide args and response to after method - sync', (done) => {
152
- const testable1 = 5;
153
- const testable2 = 6;
154
- const afterFunc = (x) => {
155
- expect(x.args.length).toBe(2);
156
- expect(x.args[0]).toBe(testable1);
157
- expect(x.args[1]).toBe(testable2);
158
- expect(x.response).toBe(testable1 + testable2);
159
- done();
160
- };
161
- class T {
162
- foo(x, y) {
163
- return x + y;
164
- }
165
- }
166
- __decorate([
167
- after({
168
- func: afterFunc,
169
- }),
170
- __metadata("design:type", Function),
171
- __metadata("design:paramtypes", [Number, Number]),
172
- __metadata("design:returntype", Number)
173
- ], T.prototype, "foo", null);
174
- const t = new T();
175
- t.foo(testable1, testable2);
176
- });
177
- it('should provide args and response to after method - async', async () => {
178
- const testable1 = 5;
179
- const testable2 = 6;
180
- const afterFunc = (x) => {
181
- expect(x.args.length).toBe(2);
182
- expect(x.args[0]).toBe(testable1);
183
- expect(x.args[1]).toBe(testable2);
184
- expect(x.response).toBe(testable1 + testable2);
185
- };
186
- class T {
187
- foo(x, y) {
188
- return Promise.resolve(x + y);
189
- }
190
- }
191
- __decorate([
192
- after({
193
- func: afterFunc,
194
- wait: true,
195
- }),
196
- __metadata("design:type", Function),
197
- __metadata("design:paramtypes", [Number, Number]),
198
- __metadata("design:returntype", Promise)
199
- ], T.prototype, "foo", null);
200
- const t = new T();
201
- await t.foo(testable1, testable2);
202
- });
203
- it('should returned result of method', async () => {
204
- const value = 42;
205
- const afterFunc = jest.fn((x) => {
206
- expect(x.response).toBe(value);
207
- });
208
- class T {
209
- foo(x) {
210
- return x;
211
- }
212
- }
213
- __decorate([
214
- after({
215
- func: afterFunc,
216
- }),
217
- __metadata("design:type", Function),
218
- __metadata("design:paramtypes", [Number]),
219
- __metadata("design:returntype", Number)
220
- ], T.prototype, "foo", null);
221
- const t = new T();
222
- const result = await t.foo(value);
223
- expect(result).toBe(value);
224
- });
225
- });
226
- //# sourceMappingURL=after.spec.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"after.spec.js","sourceRoot":"","sources":["../../../src/after/after.spec.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAGhC,QAAQ,CAAC,OAAO,EAAE,GAAG,EAAE;IACrB,EAAE,CAAC,gEAAgE,EAAE,GAAG,EAAE;QACxE,IAAI,CAAC;YACH,MAAM,aAAa,GAAQ,KAAK,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;YAEjD,MAAM,CAAC;aAGN;YADG;gBADD,aAAa;;0CACA;QAElB,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,MAAM,CAAC,yCAAyC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;YAElE,O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AEH,MAAM,CAAC;YAIL,GAAG,CAAC,CAAS;gBACX,OAAO,CAAC,CAAC;YACX,CAAC;SACF;QAHC;YAHC,KAAK,CAAI;gBACR,IAAI,EAAE,SAAS;aAChB,CAAC;;;;oCAGD;QAGH,MAAM,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC;QAClB,MAAM,MAAM,GAAG,MAAM,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QAClC,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC7B,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1,3 +0,0 @@
1
- import { Method } from '../common/model/common.model';
2
- import { AfterConfig } from './after.model';
3
- export declare function afterify<D = any, A extends any[] = any[]>(originalMethod: Method<D, A>, config: AfterConfig<any, ReturnType<typeof originalMethod>>): (...args: any[]) => void;
package/after/afterify.js DELETED
@@ -1,26 +0,0 @@
1
- export function afterify(originalMethod, config) {
2
- const resolvedConfig = {
3
- wait: false,
4
- ...config,
5
- };
6
- return async function (...args) {
7
- const afterFunc = typeof resolvedConfig.func === 'string'
8
- ? this[resolvedConfig.func].bind(this)
9
- : resolvedConfig.func;
10
- if (resolvedConfig.wait) {
11
- const response = await originalMethod.apply(this, args);
12
- afterFunc({
13
- args,
14
- response,
15
- });
16
- return response;
17
- }
18
- const response = originalMethod.apply(this, args);
19
- afterFunc({
20
- args,
21
- response,
22
- });
23
- return response;
24
- };
25
- }
26
- //# sourceMappingURL=afterify.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"afterify.js","sourceRoot":"","sources":["../../../src/after/afterify.ts"],"names":[],"mappings":"AAGA,MAAM,UAAU,QAAQ,CACtB,cAA4B,EAAE,MAA2D;IAEzF,MAAM,cAAc,GAAwD;QAC1E,IAAI,EAAE,KAAK;QACX,GAAG,MAAM;KACV,CAAC;IAEF,OAAO,KAAK,WAAW,GAAG,IAAO;QAC/B,MAAM,SAAS,GAAiD,OAAO,cAAc,CAAC,IAAI,KAAK,QAAQ;YACrG,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;YACtC,CAAC,CAAC,cAAc,CAAC,IAAI,CAAC;QAExB,IAAI,cAAc,CAAC,IAAI,EAAE,CAAC;YACxB,MAAM,QAAQ,GAAG,MAAM,cAAc,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;YACxD,SAAS,CAAC;gBACR,IAAI;gBACJ,QAAQ;aACT,CAAC,CAAC;YACH,OAAO,QAAQ,CAAC;QAClB,CAAC;QAED,MAAM,QAAQ,GAAG,cAAc,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAClD,SAAS,CAAC;YACR,IAAI;YACJ,QAAQ;SACT,CAAC,CAAC;QACH,OAAO,QAAQ,CAAC;IAClB,CAAC,CAAC;AACJ,CAAC"}
@@ -1,3 +0,0 @@
1
- import { BeforeConfig } from './before.model';
2
- import { Decorator } from '../common/model/common.model';
3
- export declare function before<T = any>(config: BeforeConfig<T>): Decorator<T>;
@@ -1,3 +0,0 @@
1
- export { before } from './before';
2
- export { beforify } from './beforify';
3
- export { BeforeConfig } from './before.model';
@@ -1,3 +0,0 @@
1
- export { before } from './before';
2
- export { beforify } from './beforify';
3
- //# sourceMappingURL=before.index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"before.index.js","sourceRoot":"","sources":["../../../src/before/before.index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC"}
package/before/before.js DELETED
@@ -1,11 +0,0 @@
1
- import { beforify } from './beforify';
2
- export function before(config) {
3
- return (target, propertyName, descriptor) => {
4
- if (descriptor.value) {
5
- descriptor.value = beforify(descriptor.value, config);
6
- return descriptor;
7
- }
8
- throw new Error('@before is applicable only on a methods.');
9
- };
10
- }
11
- //# sourceMappingURL=before.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"before.js","sourceRoot":"","sources":["../../../src/before/before.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,MAAM,UAAU,MAAM,CAAU,MAAuB;IACrD,OAAO,CACL,MAAS,EACT,YAAqB,EACrB,UAAgD,EACV,EAAE;QACxC,IAAI,UAAU,CAAC,KAAK,EAAE,CAAC;YACrB,UAAU,CAAC,KAAK,GAAG,QAAQ,CAAC,UAAU,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;YAEtD,OAAO,UAAU,CAAC;QACpB,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;IAC9D,CAAC,CAAC;AACJ,CAAC"}
@@ -1,4 +0,0 @@
1
- export interface BeforeConfig<T> {
2
- func: ((...args: any[]) => any) | keyof T;
3
- wait?: boolean;
4
- }
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=before.model.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"before.model.js","sourceRoot":"","sources":["../../../src/before/before.model.ts"],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- export {};