@idlebox/browser 0.0.19 → 0.0.22
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/docs/browser.api.json +670 -0
- package/docs/browser.api.md +39 -0
- package/docs/tsdoc-metadata.json +11 -0
- package/lib/debug/logger.cjs +2 -7
- package/lib/debug/logger.cjs.map +1 -1
- package/lib/storage/timeoutStorage.cjs +5 -19
- package/lib/storage/timeoutStorage.cjs.map +1 -1
- package/package.json +37 -37
- package/lib/_export_all_in_one_index.cjs +0 -8
- package/lib/_export_all_in_one_index.cjs.map +0 -10
- package/lib/_export_all_in_one_index.js +0 -3
- package/lib/_export_all_in_one_index.js.map +0 -1
- package/src/debug/logger.ts +0 -36
- package/src/storage/timeoutStorage.ts +0 -60
- package/src/tsconfig.json +0 -11
|
@@ -0,0 +1,670 @@
|
|
|
1
|
+
{
|
|
2
|
+
"metadata": {
|
|
3
|
+
"toolPackage": "@microsoft/api-extractor",
|
|
4
|
+
"toolVersion": "7.28.3",
|
|
5
|
+
"schemaVersion": 1009,
|
|
6
|
+
"oldestForwardsCompatibleVersion": 1001,
|
|
7
|
+
"tsdocConfig": {
|
|
8
|
+
"$schema": "https://developer.microsoft.com/json-schemas/tsdoc/v0/tsdoc.schema.json",
|
|
9
|
+
"noStandardTags": true,
|
|
10
|
+
"tagDefinitions": [
|
|
11
|
+
{
|
|
12
|
+
"tagName": "@alpha",
|
|
13
|
+
"syntaxKind": "modifier"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"tagName": "@beta",
|
|
17
|
+
"syntaxKind": "modifier"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"tagName": "@defaultValue",
|
|
21
|
+
"syntaxKind": "block"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"tagName": "@decorator",
|
|
25
|
+
"syntaxKind": "block",
|
|
26
|
+
"allowMultiple": true
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"tagName": "@deprecated",
|
|
30
|
+
"syntaxKind": "block"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"tagName": "@eventProperty",
|
|
34
|
+
"syntaxKind": "modifier"
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"tagName": "@example",
|
|
38
|
+
"syntaxKind": "block",
|
|
39
|
+
"allowMultiple": true
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"tagName": "@experimental",
|
|
43
|
+
"syntaxKind": "modifier"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"tagName": "@inheritDoc",
|
|
47
|
+
"syntaxKind": "inline"
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"tagName": "@internal",
|
|
51
|
+
"syntaxKind": "modifier"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"tagName": "@label",
|
|
55
|
+
"syntaxKind": "inline"
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"tagName": "@link",
|
|
59
|
+
"syntaxKind": "inline",
|
|
60
|
+
"allowMultiple": true
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"tagName": "@override",
|
|
64
|
+
"syntaxKind": "modifier"
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"tagName": "@packageDocumentation",
|
|
68
|
+
"syntaxKind": "modifier"
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"tagName": "@param",
|
|
72
|
+
"syntaxKind": "block",
|
|
73
|
+
"allowMultiple": true
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"tagName": "@privateRemarks",
|
|
77
|
+
"syntaxKind": "block"
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"tagName": "@public",
|
|
81
|
+
"syntaxKind": "modifier"
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
"tagName": "@readonly",
|
|
85
|
+
"syntaxKind": "modifier"
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
"tagName": "@remarks",
|
|
89
|
+
"syntaxKind": "block"
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
"tagName": "@returns",
|
|
93
|
+
"syntaxKind": "block"
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
"tagName": "@sealed",
|
|
97
|
+
"syntaxKind": "modifier"
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
"tagName": "@see",
|
|
101
|
+
"syntaxKind": "block"
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
"tagName": "@throws",
|
|
105
|
+
"syntaxKind": "block",
|
|
106
|
+
"allowMultiple": true
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
"tagName": "@typeParam",
|
|
110
|
+
"syntaxKind": "block",
|
|
111
|
+
"allowMultiple": true
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
"tagName": "@virtual",
|
|
115
|
+
"syntaxKind": "modifier"
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
"tagName": "@betaDocumentation",
|
|
119
|
+
"syntaxKind": "modifier"
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
"tagName": "@internalRemarks",
|
|
123
|
+
"syntaxKind": "block"
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
"tagName": "@preapproved",
|
|
127
|
+
"syntaxKind": "modifier"
|
|
128
|
+
}
|
|
129
|
+
],
|
|
130
|
+
"supportForTags": {
|
|
131
|
+
"@alpha": true,
|
|
132
|
+
"@beta": true,
|
|
133
|
+
"@defaultValue": true,
|
|
134
|
+
"@decorator": true,
|
|
135
|
+
"@deprecated": true,
|
|
136
|
+
"@eventProperty": true,
|
|
137
|
+
"@example": true,
|
|
138
|
+
"@experimental": true,
|
|
139
|
+
"@inheritDoc": true,
|
|
140
|
+
"@internal": true,
|
|
141
|
+
"@label": true,
|
|
142
|
+
"@link": true,
|
|
143
|
+
"@override": true,
|
|
144
|
+
"@packageDocumentation": true,
|
|
145
|
+
"@param": true,
|
|
146
|
+
"@privateRemarks": true,
|
|
147
|
+
"@public": true,
|
|
148
|
+
"@readonly": true,
|
|
149
|
+
"@remarks": true,
|
|
150
|
+
"@returns": true,
|
|
151
|
+
"@sealed": true,
|
|
152
|
+
"@see": true,
|
|
153
|
+
"@throws": true,
|
|
154
|
+
"@typeParam": true,
|
|
155
|
+
"@virtual": true,
|
|
156
|
+
"@betaDocumentation": true,
|
|
157
|
+
"@internalRemarks": true,
|
|
158
|
+
"@preapproved": true
|
|
159
|
+
},
|
|
160
|
+
"reportUnsupportedHtmlElements": false
|
|
161
|
+
}
|
|
162
|
+
},
|
|
163
|
+
"kind": "Package",
|
|
164
|
+
"canonicalReference": "@idlebox/browser!",
|
|
165
|
+
"docComment": "",
|
|
166
|
+
"name": "@idlebox/browser",
|
|
167
|
+
"preserveMemberOrder": false,
|
|
168
|
+
"members": [
|
|
169
|
+
{
|
|
170
|
+
"kind": "EntryPoint",
|
|
171
|
+
"canonicalReference": "@idlebox/browser!",
|
|
172
|
+
"name": "",
|
|
173
|
+
"preserveMemberOrder": false,
|
|
174
|
+
"members": [
|
|
175
|
+
{
|
|
176
|
+
"kind": "Class",
|
|
177
|
+
"canonicalReference": "@idlebox/browser!TimeoutStorage:class",
|
|
178
|
+
"docComment": "",
|
|
179
|
+
"excerptTokens": [
|
|
180
|
+
{
|
|
181
|
+
"kind": "Content",
|
|
182
|
+
"text": "export declare class TimeoutStorage<T> "
|
|
183
|
+
}
|
|
184
|
+
],
|
|
185
|
+
"releaseTag": "Public",
|
|
186
|
+
"typeParameters": [
|
|
187
|
+
{
|
|
188
|
+
"typeParameterName": "T",
|
|
189
|
+
"constraintTokenRange": {
|
|
190
|
+
"startIndex": 0,
|
|
191
|
+
"endIndex": 0
|
|
192
|
+
},
|
|
193
|
+
"defaultTypeTokenRange": {
|
|
194
|
+
"startIndex": 0,
|
|
195
|
+
"endIndex": 0
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
],
|
|
199
|
+
"name": "TimeoutStorage",
|
|
200
|
+
"preserveMemberOrder": false,
|
|
201
|
+
"members": [
|
|
202
|
+
{
|
|
203
|
+
"kind": "Constructor",
|
|
204
|
+
"canonicalReference": "@idlebox/browser!TimeoutStorage:constructor(1)",
|
|
205
|
+
"docComment": "/**\n * Constructs a new instance of the `TimeoutStorage` class\n */\n",
|
|
206
|
+
"excerptTokens": [
|
|
207
|
+
{
|
|
208
|
+
"kind": "Content",
|
|
209
|
+
"text": "constructor(key: "
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
"kind": "Content",
|
|
213
|
+
"text": "string"
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
"kind": "Content",
|
|
217
|
+
"text": ", storage?: "
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
"kind": "Reference",
|
|
221
|
+
"text": "Storage",
|
|
222
|
+
"canonicalReference": "!Storage:interface"
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
"kind": "Content",
|
|
226
|
+
"text": ");"
|
|
227
|
+
}
|
|
228
|
+
],
|
|
229
|
+
"releaseTag": "Public",
|
|
230
|
+
"isProtected": false,
|
|
231
|
+
"overloadIndex": 1,
|
|
232
|
+
"parameters": [
|
|
233
|
+
{
|
|
234
|
+
"parameterName": "key",
|
|
235
|
+
"parameterTypeTokenRange": {
|
|
236
|
+
"startIndex": 1,
|
|
237
|
+
"endIndex": 2
|
|
238
|
+
},
|
|
239
|
+
"isOptional": false
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
"parameterName": "storage",
|
|
243
|
+
"parameterTypeTokenRange": {
|
|
244
|
+
"startIndex": 3,
|
|
245
|
+
"endIndex": 4
|
|
246
|
+
},
|
|
247
|
+
"isOptional": true
|
|
248
|
+
}
|
|
249
|
+
]
|
|
250
|
+
},
|
|
251
|
+
{
|
|
252
|
+
"kind": "Method",
|
|
253
|
+
"canonicalReference": "@idlebox/browser!TimeoutStorage#forget:member(1)",
|
|
254
|
+
"docComment": "",
|
|
255
|
+
"excerptTokens": [
|
|
256
|
+
{
|
|
257
|
+
"kind": "Content",
|
|
258
|
+
"text": "forget(): "
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
"kind": "Content",
|
|
262
|
+
"text": "void"
|
|
263
|
+
},
|
|
264
|
+
{
|
|
265
|
+
"kind": "Content",
|
|
266
|
+
"text": ";"
|
|
267
|
+
}
|
|
268
|
+
],
|
|
269
|
+
"isStatic": false,
|
|
270
|
+
"returnTypeTokenRange": {
|
|
271
|
+
"startIndex": 1,
|
|
272
|
+
"endIndex": 2
|
|
273
|
+
},
|
|
274
|
+
"releaseTag": "Public",
|
|
275
|
+
"isProtected": false,
|
|
276
|
+
"overloadIndex": 1,
|
|
277
|
+
"parameters": [],
|
|
278
|
+
"isOptional": false,
|
|
279
|
+
"name": "forget"
|
|
280
|
+
},
|
|
281
|
+
{
|
|
282
|
+
"kind": "Method",
|
|
283
|
+
"canonicalReference": "@idlebox/browser!TimeoutStorage#getExpire:member(1)",
|
|
284
|
+
"docComment": "",
|
|
285
|
+
"excerptTokens": [
|
|
286
|
+
{
|
|
287
|
+
"kind": "Content",
|
|
288
|
+
"text": "getExpire(): "
|
|
289
|
+
},
|
|
290
|
+
{
|
|
291
|
+
"kind": "Reference",
|
|
292
|
+
"text": "Date",
|
|
293
|
+
"canonicalReference": "!Date:interface"
|
|
294
|
+
},
|
|
295
|
+
{
|
|
296
|
+
"kind": "Content",
|
|
297
|
+
"text": " | null"
|
|
298
|
+
},
|
|
299
|
+
{
|
|
300
|
+
"kind": "Content",
|
|
301
|
+
"text": ";"
|
|
302
|
+
}
|
|
303
|
+
],
|
|
304
|
+
"isStatic": false,
|
|
305
|
+
"returnTypeTokenRange": {
|
|
306
|
+
"startIndex": 1,
|
|
307
|
+
"endIndex": 3
|
|
308
|
+
},
|
|
309
|
+
"releaseTag": "Public",
|
|
310
|
+
"isProtected": false,
|
|
311
|
+
"overloadIndex": 1,
|
|
312
|
+
"parameters": [],
|
|
313
|
+
"isOptional": false,
|
|
314
|
+
"name": "getExpire"
|
|
315
|
+
},
|
|
316
|
+
{
|
|
317
|
+
"kind": "Method",
|
|
318
|
+
"canonicalReference": "@idlebox/browser!TimeoutStorage#read:member(1)",
|
|
319
|
+
"docComment": "",
|
|
320
|
+
"excerptTokens": [
|
|
321
|
+
{
|
|
322
|
+
"kind": "Content",
|
|
323
|
+
"text": "read(defaultVal: "
|
|
324
|
+
},
|
|
325
|
+
{
|
|
326
|
+
"kind": "Reference",
|
|
327
|
+
"text": "Readonly",
|
|
328
|
+
"canonicalReference": "!Readonly:type"
|
|
329
|
+
},
|
|
330
|
+
{
|
|
331
|
+
"kind": "Content",
|
|
332
|
+
"text": "<T>"
|
|
333
|
+
},
|
|
334
|
+
{
|
|
335
|
+
"kind": "Content",
|
|
336
|
+
"text": "): "
|
|
337
|
+
},
|
|
338
|
+
{
|
|
339
|
+
"kind": "Reference",
|
|
340
|
+
"text": "Readonly",
|
|
341
|
+
"canonicalReference": "!Readonly:type"
|
|
342
|
+
},
|
|
343
|
+
{
|
|
344
|
+
"kind": "Content",
|
|
345
|
+
"text": "<T>"
|
|
346
|
+
},
|
|
347
|
+
{
|
|
348
|
+
"kind": "Content",
|
|
349
|
+
"text": ";"
|
|
350
|
+
}
|
|
351
|
+
],
|
|
352
|
+
"isStatic": false,
|
|
353
|
+
"returnTypeTokenRange": {
|
|
354
|
+
"startIndex": 4,
|
|
355
|
+
"endIndex": 6
|
|
356
|
+
},
|
|
357
|
+
"releaseTag": "Public",
|
|
358
|
+
"isProtected": false,
|
|
359
|
+
"overloadIndex": 1,
|
|
360
|
+
"parameters": [
|
|
361
|
+
{
|
|
362
|
+
"parameterName": "defaultVal",
|
|
363
|
+
"parameterTypeTokenRange": {
|
|
364
|
+
"startIndex": 1,
|
|
365
|
+
"endIndex": 3
|
|
366
|
+
},
|
|
367
|
+
"isOptional": false
|
|
368
|
+
}
|
|
369
|
+
],
|
|
370
|
+
"isOptional": false,
|
|
371
|
+
"name": "read"
|
|
372
|
+
},
|
|
373
|
+
{
|
|
374
|
+
"kind": "Method",
|
|
375
|
+
"canonicalReference": "@idlebox/browser!TimeoutStorage#read:member(2)",
|
|
376
|
+
"docComment": "",
|
|
377
|
+
"excerptTokens": [
|
|
378
|
+
{
|
|
379
|
+
"kind": "Content",
|
|
380
|
+
"text": "read(): "
|
|
381
|
+
},
|
|
382
|
+
{
|
|
383
|
+
"kind": "Reference",
|
|
384
|
+
"text": "Readonly",
|
|
385
|
+
"canonicalReference": "!Readonly:type"
|
|
386
|
+
},
|
|
387
|
+
{
|
|
388
|
+
"kind": "Content",
|
|
389
|
+
"text": "<T> | undefined"
|
|
390
|
+
},
|
|
391
|
+
{
|
|
392
|
+
"kind": "Content",
|
|
393
|
+
"text": ";"
|
|
394
|
+
}
|
|
395
|
+
],
|
|
396
|
+
"isStatic": false,
|
|
397
|
+
"returnTypeTokenRange": {
|
|
398
|
+
"startIndex": 1,
|
|
399
|
+
"endIndex": 3
|
|
400
|
+
},
|
|
401
|
+
"releaseTag": "Public",
|
|
402
|
+
"isProtected": false,
|
|
403
|
+
"overloadIndex": 2,
|
|
404
|
+
"parameters": [],
|
|
405
|
+
"isOptional": false,
|
|
406
|
+
"name": "read"
|
|
407
|
+
},
|
|
408
|
+
{
|
|
409
|
+
"kind": "Method",
|
|
410
|
+
"canonicalReference": "@idlebox/browser!TimeoutStorage#save:member(1)",
|
|
411
|
+
"docComment": "",
|
|
412
|
+
"excerptTokens": [
|
|
413
|
+
{
|
|
414
|
+
"kind": "Content",
|
|
415
|
+
"text": "save(data: "
|
|
416
|
+
},
|
|
417
|
+
{
|
|
418
|
+
"kind": "Reference",
|
|
419
|
+
"text": "Readonly",
|
|
420
|
+
"canonicalReference": "!Readonly:type"
|
|
421
|
+
},
|
|
422
|
+
{
|
|
423
|
+
"kind": "Content",
|
|
424
|
+
"text": "<T>"
|
|
425
|
+
},
|
|
426
|
+
{
|
|
427
|
+
"kind": "Content",
|
|
428
|
+
"text": ", expire: "
|
|
429
|
+
},
|
|
430
|
+
{
|
|
431
|
+
"kind": "Content",
|
|
432
|
+
"text": "string | "
|
|
433
|
+
},
|
|
434
|
+
{
|
|
435
|
+
"kind": "Reference",
|
|
436
|
+
"text": "Date",
|
|
437
|
+
"canonicalReference": "!Date:interface"
|
|
438
|
+
},
|
|
439
|
+
{
|
|
440
|
+
"kind": "Content",
|
|
441
|
+
"text": "): "
|
|
442
|
+
},
|
|
443
|
+
{
|
|
444
|
+
"kind": "Content",
|
|
445
|
+
"text": "void"
|
|
446
|
+
},
|
|
447
|
+
{
|
|
448
|
+
"kind": "Content",
|
|
449
|
+
"text": ";"
|
|
450
|
+
}
|
|
451
|
+
],
|
|
452
|
+
"isStatic": false,
|
|
453
|
+
"returnTypeTokenRange": {
|
|
454
|
+
"startIndex": 7,
|
|
455
|
+
"endIndex": 8
|
|
456
|
+
},
|
|
457
|
+
"releaseTag": "Public",
|
|
458
|
+
"isProtected": false,
|
|
459
|
+
"overloadIndex": 1,
|
|
460
|
+
"parameters": [
|
|
461
|
+
{
|
|
462
|
+
"parameterName": "data",
|
|
463
|
+
"parameterTypeTokenRange": {
|
|
464
|
+
"startIndex": 1,
|
|
465
|
+
"endIndex": 3
|
|
466
|
+
},
|
|
467
|
+
"isOptional": false
|
|
468
|
+
},
|
|
469
|
+
{
|
|
470
|
+
"parameterName": "expire",
|
|
471
|
+
"parameterTypeTokenRange": {
|
|
472
|
+
"startIndex": 4,
|
|
473
|
+
"endIndex": 6
|
|
474
|
+
},
|
|
475
|
+
"isOptional": false
|
|
476
|
+
}
|
|
477
|
+
],
|
|
478
|
+
"isOptional": false,
|
|
479
|
+
"name": "save"
|
|
480
|
+
}
|
|
481
|
+
],
|
|
482
|
+
"implementsTokenRanges": []
|
|
483
|
+
},
|
|
484
|
+
{
|
|
485
|
+
"kind": "Class",
|
|
486
|
+
"canonicalReference": "@idlebox/browser!WrappedWebConsole:class",
|
|
487
|
+
"docComment": "",
|
|
488
|
+
"excerptTokens": [
|
|
489
|
+
{
|
|
490
|
+
"kind": "Content",
|
|
491
|
+
"text": "export declare class WrappedWebConsole extends "
|
|
492
|
+
},
|
|
493
|
+
{
|
|
494
|
+
"kind": "Reference",
|
|
495
|
+
"text": "WrappedConsole",
|
|
496
|
+
"canonicalReference": "@idlebox/common!WrappedConsole:class"
|
|
497
|
+
},
|
|
498
|
+
{
|
|
499
|
+
"kind": "Content",
|
|
500
|
+
"text": " "
|
|
501
|
+
}
|
|
502
|
+
],
|
|
503
|
+
"releaseTag": "Public",
|
|
504
|
+
"name": "WrappedWebConsole",
|
|
505
|
+
"preserveMemberOrder": false,
|
|
506
|
+
"members": [
|
|
507
|
+
{
|
|
508
|
+
"kind": "Constructor",
|
|
509
|
+
"canonicalReference": "@idlebox/browser!WrappedWebConsole:constructor(1)",
|
|
510
|
+
"docComment": "/**\n * Constructs a new instance of the `WrappedWebConsole` class\n */\n",
|
|
511
|
+
"excerptTokens": [
|
|
512
|
+
{
|
|
513
|
+
"kind": "Content",
|
|
514
|
+
"text": "constructor(title: "
|
|
515
|
+
},
|
|
516
|
+
{
|
|
517
|
+
"kind": "Content",
|
|
518
|
+
"text": "string"
|
|
519
|
+
},
|
|
520
|
+
{
|
|
521
|
+
"kind": "Content",
|
|
522
|
+
"text": ", { color, ...opt }?: "
|
|
523
|
+
},
|
|
524
|
+
{
|
|
525
|
+
"kind": "Reference",
|
|
526
|
+
"text": "WrappedConsoleOptions",
|
|
527
|
+
"canonicalReference": "@idlebox/common!WrappedConsoleOptions:interface"
|
|
528
|
+
},
|
|
529
|
+
{
|
|
530
|
+
"kind": "Content",
|
|
531
|
+
"text": " & "
|
|
532
|
+
},
|
|
533
|
+
{
|
|
534
|
+
"kind": "Reference",
|
|
535
|
+
"text": "WebConsoleOptions",
|
|
536
|
+
"canonicalReference": "@idlebox/browser!~WebConsoleOptions:interface"
|
|
537
|
+
},
|
|
538
|
+
{
|
|
539
|
+
"kind": "Content",
|
|
540
|
+
"text": ");"
|
|
541
|
+
}
|
|
542
|
+
],
|
|
543
|
+
"releaseTag": "Public",
|
|
544
|
+
"isProtected": false,
|
|
545
|
+
"overloadIndex": 1,
|
|
546
|
+
"parameters": [
|
|
547
|
+
{
|
|
548
|
+
"parameterName": "title",
|
|
549
|
+
"parameterTypeTokenRange": {
|
|
550
|
+
"startIndex": 1,
|
|
551
|
+
"endIndex": 2
|
|
552
|
+
},
|
|
553
|
+
"isOptional": false
|
|
554
|
+
},
|
|
555
|
+
{
|
|
556
|
+
"parameterName": "{ color, ...opt }",
|
|
557
|
+
"parameterTypeTokenRange": {
|
|
558
|
+
"startIndex": 3,
|
|
559
|
+
"endIndex": 6
|
|
560
|
+
},
|
|
561
|
+
"isOptional": true
|
|
562
|
+
}
|
|
563
|
+
]
|
|
564
|
+
},
|
|
565
|
+
{
|
|
566
|
+
"kind": "Method",
|
|
567
|
+
"canonicalReference": "@idlebox/browser!WrappedWebConsole#processColorLabel:member(1)",
|
|
568
|
+
"docComment": "",
|
|
569
|
+
"excerptTokens": [
|
|
570
|
+
{
|
|
571
|
+
"kind": "Content",
|
|
572
|
+
"text": "protected processColorLabel(msg: "
|
|
573
|
+
},
|
|
574
|
+
{
|
|
575
|
+
"kind": "Content",
|
|
576
|
+
"text": "any[]"
|
|
577
|
+
},
|
|
578
|
+
{
|
|
579
|
+
"kind": "Content",
|
|
580
|
+
"text": ", pos: "
|
|
581
|
+
},
|
|
582
|
+
{
|
|
583
|
+
"kind": "Content",
|
|
584
|
+
"text": "number"
|
|
585
|
+
},
|
|
586
|
+
{
|
|
587
|
+
"kind": "Content",
|
|
588
|
+
"text": ", level: "
|
|
589
|
+
},
|
|
590
|
+
{
|
|
591
|
+
"kind": "Content",
|
|
592
|
+
"text": "string"
|
|
593
|
+
},
|
|
594
|
+
{
|
|
595
|
+
"kind": "Content",
|
|
596
|
+
"text": ", prefix: "
|
|
597
|
+
},
|
|
598
|
+
{
|
|
599
|
+
"kind": "Content",
|
|
600
|
+
"text": "string"
|
|
601
|
+
},
|
|
602
|
+
{
|
|
603
|
+
"kind": "Content",
|
|
604
|
+
"text": "): "
|
|
605
|
+
},
|
|
606
|
+
{
|
|
607
|
+
"kind": "Content",
|
|
608
|
+
"text": "void"
|
|
609
|
+
},
|
|
610
|
+
{
|
|
611
|
+
"kind": "Content",
|
|
612
|
+
"text": ";"
|
|
613
|
+
}
|
|
614
|
+
],
|
|
615
|
+
"isStatic": false,
|
|
616
|
+
"returnTypeTokenRange": {
|
|
617
|
+
"startIndex": 9,
|
|
618
|
+
"endIndex": 10
|
|
619
|
+
},
|
|
620
|
+
"releaseTag": "Public",
|
|
621
|
+
"isProtected": true,
|
|
622
|
+
"overloadIndex": 1,
|
|
623
|
+
"parameters": [
|
|
624
|
+
{
|
|
625
|
+
"parameterName": "msg",
|
|
626
|
+
"parameterTypeTokenRange": {
|
|
627
|
+
"startIndex": 1,
|
|
628
|
+
"endIndex": 2
|
|
629
|
+
},
|
|
630
|
+
"isOptional": false
|
|
631
|
+
},
|
|
632
|
+
{
|
|
633
|
+
"parameterName": "pos",
|
|
634
|
+
"parameterTypeTokenRange": {
|
|
635
|
+
"startIndex": 3,
|
|
636
|
+
"endIndex": 4
|
|
637
|
+
},
|
|
638
|
+
"isOptional": false
|
|
639
|
+
},
|
|
640
|
+
{
|
|
641
|
+
"parameterName": "level",
|
|
642
|
+
"parameterTypeTokenRange": {
|
|
643
|
+
"startIndex": 5,
|
|
644
|
+
"endIndex": 6
|
|
645
|
+
},
|
|
646
|
+
"isOptional": false
|
|
647
|
+
},
|
|
648
|
+
{
|
|
649
|
+
"parameterName": "prefix",
|
|
650
|
+
"parameterTypeTokenRange": {
|
|
651
|
+
"startIndex": 7,
|
|
652
|
+
"endIndex": 8
|
|
653
|
+
},
|
|
654
|
+
"isOptional": false
|
|
655
|
+
}
|
|
656
|
+
],
|
|
657
|
+
"isOptional": false,
|
|
658
|
+
"name": "processColorLabel"
|
|
659
|
+
}
|
|
660
|
+
],
|
|
661
|
+
"extendsTokenRange": {
|
|
662
|
+
"startIndex": 1,
|
|
663
|
+
"endIndex": 2
|
|
664
|
+
},
|
|
665
|
+
"implementsTokenRanges": []
|
|
666
|
+
}
|
|
667
|
+
]
|
|
668
|
+
}
|
|
669
|
+
]
|
|
670
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
## API Report File for "@idlebox/browser"
|
|
2
|
+
|
|
3
|
+
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
|
|
7
|
+
import { WrappedConsole } from '@idlebox/common';
|
|
8
|
+
import { WrappedConsoleOptions } from '@idlebox/common';
|
|
9
|
+
|
|
10
|
+
// Warning: (ae-missing-release-tag) "TimeoutStorage" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
|
11
|
+
//
|
|
12
|
+
// @public (undocumented)
|
|
13
|
+
export class TimeoutStorage<T> {
|
|
14
|
+
constructor(key: string, storage?: Storage);
|
|
15
|
+
// (undocumented)
|
|
16
|
+
forget(): void;
|
|
17
|
+
// (undocumented)
|
|
18
|
+
getExpire(): Date | null;
|
|
19
|
+
// (undocumented)
|
|
20
|
+
read(defaultVal: Readonly<T>): Readonly<T>;
|
|
21
|
+
// (undocumented)
|
|
22
|
+
read(): Readonly<T> | undefined;
|
|
23
|
+
// (undocumented)
|
|
24
|
+
save(data: Readonly<T>, expire: string | Date): void;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// Warning: (ae-missing-release-tag) "WrappedWebConsole" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
|
28
|
+
//
|
|
29
|
+
// @public (undocumented)
|
|
30
|
+
export class WrappedWebConsole extends WrappedConsole {
|
|
31
|
+
// Warning: (ae-forgotten-export) The symbol "WebConsoleOptions" needs to be exported by the entry point _export_all_in_one_index.d.ts
|
|
32
|
+
constructor(title: string, { color, ...opt }?: WrappedConsoleOptions & WebConsoleOptions);
|
|
33
|
+
// (undocumented)
|
|
34
|
+
protected processColorLabel(msg: any[], pos: number, level: string, prefix: string): void;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// (No @packageDocumentation comment for this package)
|
|
38
|
+
|
|
39
|
+
```
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// This file is read by tools that parse documentation comments conforming to the TSDoc standard.
|
|
2
|
+
// It should be published with your NPM package. It should not be tracked by Git.
|
|
3
|
+
{
|
|
4
|
+
"tsdocVersion": "0.12",
|
|
5
|
+
"toolPackages": [
|
|
6
|
+
{
|
|
7
|
+
"packageName": "@microsoft/api-extractor",
|
|
8
|
+
"packageVersion": "7.28.3"
|
|
9
|
+
}
|
|
10
|
+
]
|
|
11
|
+
}
|
package/lib/debug/logger.cjs
CHANGED
|
@@ -12,14 +12,9 @@ const colorMap = {
|
|
|
12
12
|
assert: 'background:red;color:white',
|
|
13
13
|
};
|
|
14
14
|
class WrappedWebConsole extends common_1.WrappedConsole {
|
|
15
|
+
colors = colorMap;
|
|
15
16
|
constructor(title, { color, ...opt } = {}) {
|
|
16
17
|
super(title, opt);
|
|
17
|
-
Object.defineProperty(this, "colors", {
|
|
18
|
-
enumerable: true,
|
|
19
|
-
configurable: true,
|
|
20
|
-
writable: true,
|
|
21
|
-
value: colorMap
|
|
22
|
-
});
|
|
23
18
|
if (color === false) {
|
|
24
19
|
this.colors = {};
|
|
25
20
|
}
|
|
@@ -37,4 +32,4 @@ class WrappedWebConsole extends common_1.WrappedConsole {
|
|
|
37
32
|
}
|
|
38
33
|
}
|
|
39
34
|
exports.WrappedWebConsole = WrappedWebConsole;
|
|
40
|
-
//# sourceMappingURL=logger.
|
|
35
|
+
//# sourceMappingURL=logger.cjs.map
|
package/lib/debug/logger.cjs.map
CHANGED
|
@@ -6,5 +6,5 @@
|
|
|
6
6
|
"../../src/debug/logger.ts"
|
|
7
7
|
],
|
|
8
8
|
"names": [],
|
|
9
|
-
"mappings": ";;;AAAA,4CAAwE;AAMxE,MAAM,QAAQ,GAAG;IAChB,IAAI,EAAE,YAAY;IAClB,OAAO,EAAE,aAAa;IACtB,KAAK,EAAE,YAAY;IACnB,KAAK,EAAE,WAAW;IAClB,KAAK,EAAE,YAAY;IACnB,IAAI,EAAE,cAAc;IACpB,MAAM,EAAE,4BAA4B;CACpC,CAAC;AAEF,MAAa,iBAAkB,SAAQ,uBAAc;
|
|
9
|
+
"mappings": ";;;AAAA,4CAAwE;AAMxE,MAAM,QAAQ,GAAG;IAChB,IAAI,EAAE,YAAY;IAClB,OAAO,EAAE,aAAa;IACtB,KAAK,EAAE,YAAY;IACnB,KAAK,EAAE,WAAW;IAClB,KAAK,EAAE,YAAY;IACnB,IAAI,EAAE,cAAc;IACpB,MAAM,EAAE,4BAA4B;CACpC,CAAC;AAEF,MAAa,iBAAkB,SAAQ,uBAAc;IACnC,MAAM,GAA2B,QAAQ,CAAC;IAE3D,YAAY,KAAa,EAAE,EAAE,KAAK,EAAE,GAAG,GAAG,KAAgD,EAAE;QAC3F,KAAK,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QAClB,IAAI,KAAK,KAAK,KAAK,EAAE;YACpB,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;SACjB;aAAM,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;YACrC,IAAI,CAAC,MAAM,GAAG,EAAE,GAAG,QAAQ,EAAE,GAAG,KAAK,EAAE,CAAC;SACxC;IACF,CAAC;IAES,iBAAiB,CAAC,GAAU,EAAE,GAAW,EAAE,KAAa,EAAE,MAAc;QACjF,IAAI,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;YACvB,GAAG,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,EAAE,KAAK,MAAM,GAAG,GAAG,CAAC,GAAG,CAAC,EAAE,EAAE,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;SACjE;aAAM;YACN,GAAG,CAAC,GAAG,CAAC,GAAG,GAAG,MAAM,GAAG,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;SAClC;IACF,CAAC;CACD;AAnBD,8CAmBC"
|
|
10
10
|
}
|
|
@@ -2,25 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TimeoutStorage = void 0;
|
|
4
4
|
class TimeoutStorage {
|
|
5
|
+
storage;
|
|
6
|
+
valueKey;
|
|
7
|
+
expireKey;
|
|
5
8
|
constructor(key, storage = localStorage) {
|
|
6
|
-
|
|
7
|
-
enumerable: true,
|
|
8
|
-
configurable: true,
|
|
9
|
-
writable: true,
|
|
10
|
-
value: storage
|
|
11
|
-
});
|
|
12
|
-
Object.defineProperty(this, "valueKey", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
configurable: true,
|
|
15
|
-
writable: true,
|
|
16
|
-
value: void 0
|
|
17
|
-
});
|
|
18
|
-
Object.defineProperty(this, "expireKey", {
|
|
19
|
-
enumerable: true,
|
|
20
|
-
configurable: true,
|
|
21
|
-
writable: true,
|
|
22
|
-
value: void 0
|
|
23
|
-
});
|
|
9
|
+
this.storage = storage;
|
|
24
10
|
this.valueKey = key + '::value';
|
|
25
11
|
this.expireKey = key + '::expire';
|
|
26
12
|
}
|
|
@@ -67,4 +53,4 @@ class TimeoutStorage {
|
|
|
67
53
|
}
|
|
68
54
|
}
|
|
69
55
|
exports.TimeoutStorage = TimeoutStorage;
|
|
70
|
-
//# sourceMappingURL=timeoutStorage.
|
|
56
|
+
//# sourceMappingURL=timeoutStorage.cjs.map
|
|
@@ -6,5 +6,5 @@
|
|
|
6
6
|
"../../src/storage/timeoutStorage.ts"
|
|
7
7
|
],
|
|
8
8
|
"names": [],
|
|
9
|
-
"mappings": ";;;AAAA,MAAa,cAAc;
|
|
9
|
+
"mappings": ";;;AAAA,MAAa,cAAc;IAIgB;IAHzB,QAAQ,CAAS;IACjB,SAAS,CAAS;IAEnC,YAAY,GAAW,EAAmB,UAAmB,YAAY;QAA/B,YAAO,GAAP,OAAO,CAAwB;QACxE,IAAI,CAAC,QAAQ,GAAG,GAAG,GAAG,SAAS,CAAC;QAChC,IAAI,CAAC,SAAS,GAAG,GAAG,GAAG,UAAU,CAAC;IACnC,CAAC;IAED,IAAI,CAAC,IAAiB,EAAE,MAAqB;QAC5C,IAAI,MAAM,YAAY,IAAI,EAAE;YAC3B,MAAM,GAAG,MAAM,CAAC,WAAW,EAAE,CAAC;SAC9B;QAED,2DAA2D;QAC3D,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;QAC1D,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;IAC9C,CAAC;IAED,MAAM;QACL,yCAAyC;QACzC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACxC,CAAC;IAED,SAAS;QACR,MAAM,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAC/C,IAAI,CAAC,CAAC,IAAI,IAAI,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,IAAI,EAAE,EAAE;YACnC,0CAA0C;YAC1C,IAAI,CAAC,MAAM,EAAE,CAAC;YACd,OAAO,IAAI,CAAC;SACZ;QAED,OAAO,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC;IACpB,CAAC;IAKD,IAAI,CAAC,UAAwB;QAC5B,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACjD,IAAI,CAAC,IAAI,EAAE;YACV,OAAO,UAAU,CAAC;SAClB;QAED,MAAM,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAC/C,IAAI,CAAC,CAAC,IAAI,IAAI,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,IAAI,EAAE,EAAE;YACnC,0CAA0C;YAC1C,IAAI,CAAC,MAAM,EAAE,CAAC;YACd,OAAO,UAAU,CAAC;SAClB;QAED,IAAI;YACH,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;SACxB;QAAC,OAAO,CAAC,EAAE;YACX,qDAAqD;YACrD,IAAI,CAAC,MAAM,EAAE,CAAC;YACd,OAAO,UAAU,CAAC;SAClB;IACF,CAAC;CACD;AA3DD,wCA2DC"
|
|
10
10
|
}
|
package/package.json
CHANGED
|
@@ -1,38 +1,38 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
2
|
+
"name": "@idlebox/browser",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "0.0.22",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"main": "./lib/_export_all_in_one_index.cjs",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"import": "./lib/_export_all_in_one_index.js",
|
|
10
|
+
"require": "./lib/_export_all_in_one_index.cjs"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"typings": "docs/package-public.d.ts",
|
|
14
|
+
"repository": "https://github.com/GongT/baobao",
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"@idlebox/common": "^1.3.10",
|
|
17
|
+
"source-map-support": "^0.5.21",
|
|
18
|
+
"tslib": "^2.4.0"
|
|
19
|
+
},
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"@build-script/builder": "^3.2.7",
|
|
22
|
+
"@build-script/export-all-in-one": "^3.1.5",
|
|
23
|
+
"@build-script/single-dog-asset": "^1.0.22",
|
|
24
|
+
"@build-script/typescript-transformer-dual-package": "^2.0.1",
|
|
25
|
+
"gulp": "^4.0.2",
|
|
26
|
+
"local-rig": "^1.0.0",
|
|
27
|
+
"ttypescript": "^1.5.13",
|
|
28
|
+
"typescript": "^4.7.4"
|
|
29
|
+
},
|
|
30
|
+
"monorepo": "rush",
|
|
31
|
+
"scripts": {
|
|
32
|
+
"test": "build-script test",
|
|
33
|
+
"build": "build-script build",
|
|
34
|
+
"clean": "rimraf lib dist .rush temp",
|
|
35
|
+
"distclean": "build-script distclean",
|
|
36
|
+
"watch": "build-script watch"
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TimeoutStorage = exports.WrappedWebConsole = void 0;
|
|
4
|
-
var logger_cjs_1 = require("./debug/logger.cjs");
|
|
5
|
-
Object.defineProperty(exports, "WrappedWebConsole", { enumerable: true, get: function () { return logger_cjs_1.WrappedWebConsole; } });
|
|
6
|
-
var timeoutStorage_cjs_1 = require("./storage/timeoutStorage.cjs");
|
|
7
|
-
Object.defineProperty(exports, "TimeoutStorage", { enumerable: true, get: function () { return timeoutStorage_cjs_1.TimeoutStorage; } });
|
|
8
|
-
//# sourceMappingURL=_export_all_in_one_index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"_export_all_in_one_index.js","sourceRoot":"","sources":["../source/_export_all_in_one_index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,0BAAsB;AAClD,OAAO,EAAE,cAAc,EAAE,oCAAgC"}
|
package/src/debug/logger.ts
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { WrappedConsole, WrappedConsoleOptions } from '@idlebox/common';
|
|
2
|
-
|
|
3
|
-
interface WebConsoleOptions {
|
|
4
|
-
color?: boolean | Partial<typeof colorMap>;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
const colorMap = {
|
|
8
|
-
info: 'color:blue',
|
|
9
|
-
success: 'color:green',
|
|
10
|
-
debug: 'color:gray',
|
|
11
|
-
error: 'color:red',
|
|
12
|
-
trace: 'color:gray',
|
|
13
|
-
warn: 'color:yellow',
|
|
14
|
-
assert: 'background:red;color:white',
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export class WrappedWebConsole extends WrappedConsole {
|
|
18
|
-
private readonly colors: Record<string, string> = colorMap;
|
|
19
|
-
|
|
20
|
-
constructor(title: string, { color, ...opt }: WrappedConsoleOptions & WebConsoleOptions = {}) {
|
|
21
|
-
super(title, opt);
|
|
22
|
-
if (color === false) {
|
|
23
|
-
this.colors = {};
|
|
24
|
-
} else if (typeof color === 'object') {
|
|
25
|
-
this.colors = { ...colorMap, ...color };
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
protected processColorLabel(msg: any[], pos: number, level: string, prefix: string): void {
|
|
30
|
-
if (this.colors[level]) {
|
|
31
|
-
msg.splice(pos, 1, `%c${prefix}${msg[pos]}`, this.colors[level]);
|
|
32
|
-
} else {
|
|
33
|
-
msg[pos] = `${prefix}${msg[pos]}`;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
export class TimeoutStorage<T> {
|
|
2
|
-
private readonly valueKey: string;
|
|
3
|
-
private readonly expireKey: string;
|
|
4
|
-
|
|
5
|
-
constructor(key: string, private readonly storage: Storage = localStorage) {
|
|
6
|
-
this.valueKey = key + '::value';
|
|
7
|
-
this.expireKey = key + '::expire';
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
save(data: Readonly<T>, expire: string | Date) {
|
|
11
|
-
if (expire instanceof Date) {
|
|
12
|
-
expire = expire.toUTCString();
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
// console.log('[%s] add [%s] %s', this.key, expire, data);
|
|
16
|
-
this.storage.setItem(this.valueKey, JSON.stringify(data));
|
|
17
|
-
this.storage.setItem(this.expireKey, expire);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
forget() {
|
|
21
|
-
// console.log('[%s] forget.', this.key);
|
|
22
|
-
this.storage.removeItem(this.valueKey);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
getExpire() {
|
|
26
|
-
const o = this.storage.getItem(this.expireKey);
|
|
27
|
-
if (!o || new Date(o) < new Date()) {
|
|
28
|
-
// console.log('[%s] outdate.', this.key);
|
|
29
|
-
this.forget();
|
|
30
|
-
return null;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
return new Date(o);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
read(defaultVal: Readonly<T>): Readonly<T>;
|
|
37
|
-
read(): Readonly<T> | undefined;
|
|
38
|
-
|
|
39
|
-
read(defaultVal?: Readonly<T>): Readonly<T> | undefined {
|
|
40
|
-
const json = this.storage.getItem(this.valueKey);
|
|
41
|
-
if (!json) {
|
|
42
|
-
return defaultVal;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
const o = this.storage.getItem(this.expireKey);
|
|
46
|
-
if (!o || new Date(o) < new Date()) {
|
|
47
|
-
// console.log('[%s] outdate.', this.key);
|
|
48
|
-
this.forget();
|
|
49
|
-
return defaultVal;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
try {
|
|
53
|
-
return JSON.parse(json);
|
|
54
|
-
} catch (e) {
|
|
55
|
-
// console.warn('[%s] JSON %s', this.key, e.message);
|
|
56
|
-
this.forget();
|
|
57
|
-
return defaultVal;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}
|
package/src/tsconfig.json
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "../node_modules/@build-script/single-dog-asset/package/tsconfig.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"outDir": "../lib",
|
|
5
|
-
"rootDir": ".",
|
|
6
|
-
"declaration": false,
|
|
7
|
-
"declarationMap": false,
|
|
8
|
-
"lib": ["DOM", "ESNext", "ESNext.Array", "ESNext.AsyncIterable", "ESNext.Symbol"],
|
|
9
|
-
"types": []
|
|
10
|
-
}
|
|
11
|
-
}
|