simple-boot-front 1.0.95 → 1.0.99

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. package/README.MD +335 -335
  2. package/SimpleBootFront.d.ts +32 -25
  3. package/SimpleBootFront.js +327 -231
  4. package/decorators/Component.d.ts +11 -11
  5. package/decorators/Component.js +30 -54
  6. package/decorators/Script.d.ts +10 -10
  7. package/decorators/Script.js +31 -31
  8. package/decorators/inject/InjectFrontSituationType.d.ts +3 -0
  9. package/decorators/inject/InjectFrontSituationType.js +7 -0
  10. package/fetch/Fetcher.d.ts +4 -4
  11. package/fetch/Fetcher.js +9 -9
  12. package/lifecycle/OnChangedRender.d.ts +3 -3
  13. package/lifecycle/OnChangedRender.js +2 -2
  14. package/lifecycle/OnDestroy.d.ts +3 -3
  15. package/lifecycle/OnDestroy.js +2 -2
  16. package/lifecycle/OnFinish.d.ts +3 -3
  17. package/lifecycle/OnFinish.js +2 -2
  18. package/lifecycle/OnInit.d.ts +8 -3
  19. package/lifecycle/OnInit.js +2 -2
  20. package/lifecycle/OnInitedChild.d.ts +3 -3
  21. package/lifecycle/OnInitedChild.js +2 -2
  22. package/option/SimFrontOption.d.ts +14 -14
  23. package/option/SimFrontOption.js +45 -45
  24. package/package.json +84 -82
  25. package/script/ScriptRunnable.d.ts +7 -7
  26. package/script/ScriptRunnable.js +22 -22
  27. package/service/CookieService.d.ts +11 -8
  28. package/service/CookieService.js +54 -42
  29. package/service/HttpService.d.ts +3 -3
  30. package/service/HttpService.js +23 -23
  31. package/service/MetaTagService.d.ts +11 -0
  32. package/service/MetaTagService.js +52 -0
  33. package/service/Navigation.d.ts +18 -12
  34. package/service/Navigation.js +117 -75
  35. package/service/ScriptService.d.ts +7 -7
  36. package/service/ScriptService.js +39 -39
  37. package/service/StorageService.d.ts +12 -0
  38. package/service/StorageService.js +67 -0
  39. package/service/view/View.d.ts +6 -6
  40. package/service/view/View.js +29 -29
  41. package/service/view/ViewService.d.ts +7 -7
  42. package/service/view/ViewService.js +46 -46
  43. package/throwable/RouterError.d.ts +4 -4
  44. package/throwable/RouterError.js +27 -27
  45. package/throwable/RouterIntentError.d.ts +4 -4
  46. package/throwable/RouterIntentError.js +27 -27
  47. package/throwable/RouterNotFount.d.ts +4 -4
  48. package/throwable/RouterNotFount.js +27 -27
  49. package/utils/dom/DomUtils.d.ts +0 -13
  50. package/utils/dom/DomUtils.js +0 -45
  51. package/utils/node/NodeUtils.d.ts +0 -10
  52. package/utils/node/NodeUtils.js +0 -25
  53. package/utils/window/LocationUtils.d.ts +0 -8
  54. package/utils/window/LocationUtils.js +0 -34
@@ -1,8 +1,11 @@
1
- export declare class CookieService {
2
- get(key: string): string | undefined;
3
- getAll(): {
4
- [k: string]: string;
5
- };
6
- set(name: string, value: string, exp: number): void;
7
- delete(name: string): void;
8
- }
1
+ import { SimFrontOption } from '../option/SimFrontOption';
2
+ export declare class CookieService {
3
+ private option;
4
+ constructor(option: SimFrontOption);
5
+ get(key: string): string | undefined;
6
+ getAll(): {
7
+ [k: string]: string;
8
+ };
9
+ set(name: string, value: string, exp?: number): void;
10
+ delete(name: string, path?: string): void;
11
+ }
@@ -1,42 +1,54 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- 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;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.CookieService = void 0;
10
- var SimDecorator_1 = require("simple-boot-core/decorators/SimDecorator");
11
- var CookieService = (function () {
12
- function CookieService() {
13
- }
14
- CookieService.prototype.get = function (key) {
15
- return this.getAll()[key];
16
- };
17
- CookieService.prototype.getAll = function () {
18
- var _a;
19
- var all = {};
20
- var strings = (_a = document.cookie.split(';')) !== null && _a !== void 0 ? _a : [];
21
- strings.forEach(function (it) {
22
- var set = it.split('=');
23
- if (set[0] && set[1] && set[0].trim().length > 0 && set[1].trim().length > 0) {
24
- all[set[0].trim()] = set[1].trim();
25
- }
26
- });
27
- return all;
28
- };
29
- CookieService.prototype.set = function (name, value, exp) {
30
- var date = new Date();
31
- date.setTime(date.getTime() + exp);
32
- document.cookie = name + '=' + value + ';expires=' + date.toUTCString() + ';path=/';
33
- };
34
- CookieService.prototype.delete = function (name) {
35
- document.cookie = name + '=; expires=Thu, 01 Jan 1999 00:00:10 GMT;';
36
- };
37
- CookieService = __decorate([
38
- (0, SimDecorator_1.Sim)()
39
- ], CookieService);
40
- return CookieService;
41
- }());
42
- exports.CookieService = CookieService;
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ 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;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.CookieService = void 0;
13
+ var SimDecorator_1 = require("simple-boot-core/decorators/SimDecorator");
14
+ var SimFrontOption_1 = require("../option/SimFrontOption");
15
+ var CookieService = (function () {
16
+ function CookieService(option) {
17
+ this.option = option;
18
+ }
19
+ CookieService.prototype.get = function (key) {
20
+ return this.getAll()[key];
21
+ };
22
+ CookieService.prototype.getAll = function () {
23
+ var _a;
24
+ var all = {};
25
+ var strings = (_a = this.option.window.document.cookie.split(';')) !== null && _a !== void 0 ? _a : [];
26
+ strings.forEach(function (it) {
27
+ var set = it.split('=');
28
+ if (set[0] && set[1] && set[0].trim().length > 0 && set[1].trim().length > 0) {
29
+ all[set[0].trim()] = set[1].trim();
30
+ }
31
+ });
32
+ return all;
33
+ };
34
+ CookieService.prototype.set = function (name, value, exp) {
35
+ if (exp === undefined) {
36
+ this.option.window.document.cookie = name + '=' + value + ';path=/';
37
+ }
38
+ else {
39
+ var date = new Date();
40
+ date.setTime(date.getTime() + exp);
41
+ this.option.window.document.cookie = name + '=' + value + ';expires=' + date.toUTCString() + ';path=/';
42
+ }
43
+ };
44
+ CookieService.prototype.delete = function (name, path) {
45
+ if (path === void 0) { path = '/'; }
46
+ this.option.window.document.cookie = name + '=; expires=Thu, 01 Jan 1999 00:00:10 GMT;' + " path=".concat(path);
47
+ };
48
+ CookieService = __decorate([
49
+ (0, SimDecorator_1.Sim)(),
50
+ __metadata("design:paramtypes", [SimFrontOption_1.SimFrontOption])
51
+ ], CookieService);
52
+ return CookieService;
53
+ }());
54
+ exports.CookieService = CookieService;
@@ -1,3 +1,3 @@
1
- export declare class HttpService {
2
- constructor();
3
- }
1
+ export declare class HttpService {
2
+ constructor();
3
+ }
@@ -1,23 +1,23 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- 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;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- var __metadata = (this && this.__metadata) || function (k, v) {
9
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.HttpService = void 0;
13
- var SimDecorator_1 = require("simple-boot-core/decorators/SimDecorator");
14
- var HttpService = (function () {
15
- function HttpService() {
16
- }
17
- HttpService = __decorate([
18
- (0, SimDecorator_1.Sim)(),
19
- __metadata("design:paramtypes", [])
20
- ], HttpService);
21
- return HttpService;
22
- }());
23
- exports.HttpService = HttpService;
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ 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;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.HttpService = void 0;
13
+ var SimDecorator_1 = require("simple-boot-core/decorators/SimDecorator");
14
+ var HttpService = (function () {
15
+ function HttpService() {
16
+ }
17
+ HttpService = __decorate([
18
+ (0, SimDecorator_1.Sim)(),
19
+ __metadata("design:paramtypes", [])
20
+ ], HttpService);
21
+ return HttpService;
22
+ }());
23
+ exports.HttpService = HttpService;
@@ -0,0 +1,11 @@
1
+ import { SimFrontOption } from '../option/SimFrontOption';
2
+ export declare class MetaTagService {
3
+ option: SimFrontOption;
4
+ constructor(option: SimFrontOption);
5
+ setMetaTag(selector: string, set: {
6
+ [key: string]: string;
7
+ }): void;
8
+ createMetaTag(set: {
9
+ [p: string]: string;
10
+ }): HTMLMetaElement;
11
+ }
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ 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;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.MetaTagService = void 0;
13
+ var SimDecorator_1 = require("simple-boot-core/decorators/SimDecorator");
14
+ var SimFrontOption_1 = require("../option/SimFrontOption");
15
+ var MetaTagService = (function () {
16
+ function MetaTagService(option) {
17
+ this.option = option;
18
+ }
19
+ MetaTagService.prototype.setMetaTag = function (selector, set) {
20
+ var target = this.option.window.document.querySelector(selector);
21
+ if (!target) {
22
+ this.option.window.document.head.appendChild(this.createMetaTag(set));
23
+ }
24
+ else {
25
+ Object.entries(set).forEach(function (_a) {
26
+ var key = _a[0], value = _a[1];
27
+ if (null === value) {
28
+ target.removeAttribute(key);
29
+ }
30
+ else {
31
+ target.setAttribute(key, value);
32
+ }
33
+ });
34
+ }
35
+ };
36
+ MetaTagService.prototype.createMetaTag = function (set) {
37
+ var meta = this.option.window.document.createElement('meta');
38
+ Object.entries(set).forEach(function (_a) {
39
+ var key = _a[0], value = _a[1];
40
+ if (null !== value) {
41
+ meta.setAttribute(key, value);
42
+ }
43
+ });
44
+ return meta;
45
+ };
46
+ MetaTagService = __decorate([
47
+ (0, SimDecorator_1.Sim)(),
48
+ __metadata("design:paramtypes", [SimFrontOption_1.SimFrontOption])
49
+ ], MetaTagService);
50
+ return MetaTagService;
51
+ }());
52
+ exports.MetaTagService = MetaTagService;
@@ -1,12 +1,18 @@
1
- import { SimFrontOption } from '../option/SimFrontOption';
2
- export declare class Navigation {
3
- private option;
4
- constructor(option: SimFrontOption);
5
- get path(): string;
6
- get queryParams(): Map<string, string>;
7
- get pathInfo(): {
8
- path: string;
9
- queryParams: Map<string, string>;
10
- };
11
- go(path: string, data?: {}, title?: string): void;
12
- }
1
+ import { SimFrontOption } from '../option/SimFrontOption';
2
+ export declare class Navigation {
3
+ option: SimFrontOption;
4
+ constructor(option: SimFrontOption);
5
+ get url(): string;
6
+ get path(): string;
7
+ get queryParams(): Map<string, string>;
8
+ get queryParamsObject(): any;
9
+ get pathInfo(): {
10
+ path: string;
11
+ queryParams: Map<string, string>;
12
+ };
13
+ reload(): void;
14
+ pathAndSearch(): string;
15
+ goNoPopStateEvent(path: string, data?: any, title?: string): void;
16
+ go(path: string, data?: any, title?: string): void;
17
+ state(): any;
18
+ }
@@ -1,75 +1,117 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- 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;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- var __metadata = (this && this.__metadata) || function (k, v) {
9
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.Navigation = void 0;
13
- var SimDecorator_1 = require("simple-boot-core/decorators/SimDecorator");
14
- var SimFrontOption_1 = require("../option/SimFrontOption");
15
- var LocationUtils_1 = require("../utils/window/LocationUtils");
16
- var Navigation = (function () {
17
- function Navigation(option) {
18
- this.option = option;
19
- }
20
- Object.defineProperty(Navigation.prototype, "path", {
21
- get: function () {
22
- if (SimFrontOption_1.UrlType.path === this.option.urlType) {
23
- return LocationUtils_1.LocationUtils.path();
24
- }
25
- else if (SimFrontOption_1.UrlType.hash === this.option.urlType) {
26
- return LocationUtils_1.LocationUtils.hashPath();
27
- }
28
- else {
29
- return '';
30
- }
31
- },
32
- enumerable: false,
33
- configurable: true
34
- });
35
- Object.defineProperty(Navigation.prototype, "queryParams", {
36
- get: function () {
37
- if (SimFrontOption_1.UrlType.path === this.option.urlType) {
38
- return LocationUtils_1.LocationUtils.pathQueryParams();
39
- }
40
- else if (SimFrontOption_1.UrlType.hash === this.option.urlType) {
41
- return LocationUtils_1.LocationUtils.hashQueryParams();
42
- }
43
- else {
44
- return new Map();
45
- }
46
- },
47
- enumerable: false,
48
- configurable: true
49
- });
50
- Object.defineProperty(Navigation.prototype, "pathInfo", {
51
- get: function () {
52
- return { path: this.path, queryParams: this.queryParams };
53
- },
54
- enumerable: false,
55
- configurable: true
56
- });
57
- Navigation.prototype.go = function (path, data, title) {
58
- if (data === void 0) { data = {}; }
59
- if (title === void 0) { title = ''; }
60
- if (SimFrontOption_1.UrlType.path === this.option.urlType) {
61
- history.pushState(data, title, path);
62
- }
63
- else if (SimFrontOption_1.UrlType.hash === this.option.urlType) {
64
- path = '#' + path.substring(1);
65
- history.pushState(data, title, path);
66
- }
67
- window.dispatchEvent(new Event('popstate'));
68
- };
69
- Navigation = __decorate([
70
- (0, SimDecorator_1.Sim)(),
71
- __metadata("design:paramtypes", [SimFrontOption_1.SimFrontOption])
72
- ], Navigation);
73
- return Navigation;
74
- }());
75
- exports.Navigation = Navigation;
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ 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;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.Navigation = void 0;
13
+ var SimDecorator_1 = require("simple-boot-core/decorators/SimDecorator");
14
+ var SimFrontOption_1 = require("../option/SimFrontOption");
15
+ var LocationUtils_1 = require("dom-render/utils/location/LocationUtils");
16
+ var Navigation = (function () {
17
+ function Navigation(option) {
18
+ this.option = option;
19
+ }
20
+ Object.defineProperty(Navigation.prototype, "url", {
21
+ get: function () {
22
+ var queryParams = this.queryParamsObject;
23
+ var queryString = Object.entries(queryParams).map(function (_a) {
24
+ var key = _a[0], value = _a[1];
25
+ return "".concat(key, "=").concat(value);
26
+ }).join('&');
27
+ var path = this.path;
28
+ return path + (queryString.length > 0 ? ('?' + queryString) : '');
29
+ },
30
+ enumerable: false,
31
+ configurable: true
32
+ });
33
+ Object.defineProperty(Navigation.prototype, "path", {
34
+ get: function () {
35
+ if (SimFrontOption_1.UrlType.path === this.option.urlType) {
36
+ return LocationUtils_1.LocationUtils.path(this.option.window);
37
+ }
38
+ else if (SimFrontOption_1.UrlType.hash === this.option.urlType) {
39
+ return LocationUtils_1.LocationUtils.hashPath(this.option.window);
40
+ }
41
+ else {
42
+ return '';
43
+ }
44
+ },
45
+ enumerable: false,
46
+ configurable: true
47
+ });
48
+ Object.defineProperty(Navigation.prototype, "queryParams", {
49
+ get: function () {
50
+ if (SimFrontOption_1.UrlType.path === this.option.urlType) {
51
+ return LocationUtils_1.LocationUtils.pathQueryParams(this.option.window);
52
+ }
53
+ else if (SimFrontOption_1.UrlType.hash === this.option.urlType) {
54
+ return LocationUtils_1.LocationUtils.hashQueryParams(this.option.window);
55
+ }
56
+ else {
57
+ return new Map();
58
+ }
59
+ },
60
+ enumerable: false,
61
+ configurable: true
62
+ });
63
+ Object.defineProperty(Navigation.prototype, "queryParamsObject", {
64
+ get: function () {
65
+ if (SimFrontOption_1.UrlType.path === this.option.urlType) {
66
+ return LocationUtils_1.LocationUtils.pathQueryParamsObject(this.option.window);
67
+ }
68
+ else if (SimFrontOption_1.UrlType.hash === this.option.urlType) {
69
+ return LocationUtils_1.LocationUtils.hashQueryParamsObject(this.option.window);
70
+ }
71
+ else {
72
+ return {};
73
+ }
74
+ },
75
+ enumerable: false,
76
+ configurable: true
77
+ });
78
+ Object.defineProperty(Navigation.prototype, "pathInfo", {
79
+ get: function () {
80
+ return { path: this.path, queryParams: this.queryParams };
81
+ },
82
+ enumerable: false,
83
+ configurable: true
84
+ });
85
+ Navigation.prototype.reload = function () {
86
+ this.option.window.dispatchEvent(new Event('popstate'));
87
+ };
88
+ Navigation.prototype.pathAndSearch = function () {
89
+ return this.option.window.location.pathname + this.option.window.location.search;
90
+ };
91
+ Navigation.prototype.goNoPopStateEvent = function (path, data, title) {
92
+ if (data === void 0) { data = {}; }
93
+ if (title === void 0) { title = ''; }
94
+ if (SimFrontOption_1.UrlType.path === this.option.urlType) {
95
+ this.option.window.history.pushState(data, title, path);
96
+ }
97
+ else if (SimFrontOption_1.UrlType.hash === this.option.urlType) {
98
+ path = '#' + path.substring(1);
99
+ this.option.window.history.pushState(data, title, path);
100
+ }
101
+ };
102
+ Navigation.prototype.go = function (path, data, title) {
103
+ if (data === void 0) { data = {}; }
104
+ if (title === void 0) { title = ''; }
105
+ this.goNoPopStateEvent(path, data, title);
106
+ this.option.window.dispatchEvent(new Event('popstate'));
107
+ };
108
+ Navigation.prototype.state = function () {
109
+ return this.option.window.history.state;
110
+ };
111
+ Navigation = __decorate([
112
+ (0, SimDecorator_1.Sim)(),
113
+ __metadata("design:paramtypes", [SimFrontOption_1.SimFrontOption])
114
+ ], Navigation);
115
+ return Navigation;
116
+ }());
117
+ exports.Navigation = Navigation;
@@ -1,7 +1,7 @@
1
- import { ScriptRunnable } from '../script/ScriptRunnable';
2
- import { SimstanceManager } from 'simple-boot-core/simstance/SimstanceManager';
3
- export declare class ScriptService {
4
- private simstanceManager;
5
- constructor(simstanceManager: SimstanceManager);
6
- getScript<T = ScriptRunnable>(name: string): T | undefined;
7
- }
1
+ import { ScriptRunnable } from '../script/ScriptRunnable';
2
+ import { SimstanceManager } from 'simple-boot-core/simstance/SimstanceManager';
3
+ export declare class ScriptService {
4
+ private simstanceManager;
5
+ constructor(simstanceManager: SimstanceManager);
6
+ getScript<T = ScriptRunnable>(name: string): T | undefined;
7
+ }
@@ -1,39 +1,39 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- 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;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- var __metadata = (this && this.__metadata) || function (k, v) {
9
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.ScriptService = void 0;
13
- var SimDecorator_1 = require("simple-boot-core/decorators/SimDecorator");
14
- var Script_1 = require("../decorators/Script");
15
- var SimstanceManager_1 = require("simple-boot-core/simstance/SimstanceManager");
16
- var ScriptService = (function () {
17
- function ScriptService(simstanceManager) {
18
- this.simstanceManager = simstanceManager;
19
- }
20
- ScriptService.prototype.getScript = function (name) {
21
- var val = Script_1.scripts.get(name);
22
- var obj = undefined;
23
- if (val) {
24
- try {
25
- obj = this.simstanceManager.getOrNewSim(val);
26
- }
27
- catch (e) {
28
- obj = this.simstanceManager.newSim(val);
29
- }
30
- }
31
- return obj;
32
- };
33
- ScriptService = __decorate([
34
- (0, SimDecorator_1.Sim)(),
35
- __metadata("design:paramtypes", [SimstanceManager_1.SimstanceManager])
36
- ], ScriptService);
37
- return ScriptService;
38
- }());
39
- exports.ScriptService = ScriptService;
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ 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;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.ScriptService = void 0;
13
+ var SimDecorator_1 = require("simple-boot-core/decorators/SimDecorator");
14
+ var Script_1 = require("../decorators/Script");
15
+ var SimstanceManager_1 = require("simple-boot-core/simstance/SimstanceManager");
16
+ var ScriptService = (function () {
17
+ function ScriptService(simstanceManager) {
18
+ this.simstanceManager = simstanceManager;
19
+ }
20
+ ScriptService.prototype.getScript = function (name) {
21
+ var val = Script_1.scripts.get(name);
22
+ var obj = undefined;
23
+ if (val) {
24
+ try {
25
+ obj = this.simstanceManager.getOrNewSim(val);
26
+ }
27
+ catch (e) {
28
+ obj = this.simstanceManager.newSim(val);
29
+ }
30
+ }
31
+ return obj;
32
+ };
33
+ ScriptService = __decorate([
34
+ (0, SimDecorator_1.Sim)(),
35
+ __metadata("design:paramtypes", [SimstanceManager_1.SimstanceManager])
36
+ ], ScriptService);
37
+ return ScriptService;
38
+ }());
39
+ exports.ScriptService = ScriptService;
@@ -0,0 +1,12 @@
1
+ import { SimFrontOption } from '../option/SimFrontOption';
2
+ export declare class StorageService {
3
+ option: SimFrontOption;
4
+ constructor(option: SimFrontOption);
5
+ setLocalStorageItem(k: string, v: string | any, window?: Window): void;
6
+ getLocalStorageItem(k: string, window?: Window): string | null;
7
+ cutLocalStorageItem(k: string, window?: Window): string | null;
8
+ removeLocalStorageItem(k: string, window?: Window): void;
9
+ getLocalStorageJsonItem<T>(k: string, window?: Window): T | undefined;
10
+ cutLocalStorageJsonItem<T>(k: string, window?: Window): T | undefined;
11
+ clearLocalStorage(window?: Window): void;
12
+ }
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ 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;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.StorageService = void 0;
13
+ var SimDecorator_1 = require("simple-boot-core/decorators/SimDecorator");
14
+ var SimFrontOption_1 = require("../option/SimFrontOption");
15
+ var StorageUtils_1 = require("dom-render/utils/storage/StorageUtils");
16
+ var StorageService = (function () {
17
+ function StorageService(option) {
18
+ this.option = option;
19
+ }
20
+ StorageService.prototype.setLocalStorageItem = function (k, v, window) {
21
+ if (window === void 0) { window = this.option.window; }
22
+ if (typeof v === 'object') {
23
+ v = JSON.stringify(v);
24
+ }
25
+ window.localStorage.setItem(k, v);
26
+ };
27
+ StorageService.prototype.getLocalStorageItem = function (k, window) {
28
+ if (window === void 0) { window = this.option.window; }
29
+ return window.localStorage.getItem(k);
30
+ };
31
+ StorageService.prototype.cutLocalStorageItem = function (k, window) {
32
+ if (window === void 0) { window = this.option.window; }
33
+ var data = StorageUtils_1.StorageUtils.getLocalStorageItem(k, window);
34
+ StorageUtils_1.StorageUtils.removeLocalStorageItem(k, window);
35
+ return data;
36
+ };
37
+ StorageService.prototype.removeLocalStorageItem = function (k, window) {
38
+ if (window === void 0) { window = this.option.window; }
39
+ return window.localStorage.removeItem(k);
40
+ };
41
+ StorageService.prototype.getLocalStorageJsonItem = function (k, window) {
42
+ if (window === void 0) { window = this.option.window; }
43
+ var item = window.localStorage.getItem(k);
44
+ if (item) {
45
+ return JSON.parse(item);
46
+ }
47
+ else {
48
+ return undefined;
49
+ }
50
+ };
51
+ StorageService.prototype.cutLocalStorageJsonItem = function (k, window) {
52
+ if (window === void 0) { window = this.option.window; }
53
+ var item = StorageUtils_1.StorageUtils.getLocalStorageJsonItem(k, window);
54
+ StorageUtils_1.StorageUtils.removeLocalStorageItem(k, window);
55
+ return item;
56
+ };
57
+ StorageService.prototype.clearLocalStorage = function (window) {
58
+ if (window === void 0) { window = this.option.window; }
59
+ window.localStorage.clear();
60
+ };
61
+ StorageService = __decorate([
62
+ (0, SimDecorator_1.Sim)(),
63
+ __metadata("design:paramtypes", [SimFrontOption_1.SimFrontOption])
64
+ ], StorageService);
65
+ return StorageService;
66
+ }());
67
+ exports.StorageService = StorageService;