x4js 1.5.24 → 1.5.26
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/lib/cjs/index.js +9 -9
- package/lib/cjs/index.js.map +4 -4
- package/lib/esm/index.js.map +7 -0
- package/lib/esm/index.mjs +132 -119
- package/lib/esm/index.mjs.map +3 -3
- package/lib/src/application.ts +13 -2
- package/lib/src/router.ts +4 -0
- package/lib/src/version.ts +1 -1
- package/lib/types/application.d.ts +4 -0
- package/lib/types/version.d.ts +1 -1
- package/package.json +1 -1
package/lib/src/application.ts
CHANGED
|
@@ -33,6 +33,7 @@ import { BaseComponent, BaseComponentEventMap, BaseComponentProps } from './base
|
|
|
33
33
|
import { Component, flyWrap } from './component'
|
|
34
34
|
import { Settings } from './settings'
|
|
35
35
|
import { _tr } from './i18n'
|
|
36
|
+
import { Router } from './router'
|
|
36
37
|
|
|
37
38
|
const _x4_touch_time = Symbol( );
|
|
38
39
|
|
|
@@ -97,6 +98,8 @@ export class Application<P extends ApplicationProps = ApplicationProps, E extend
|
|
|
97
98
|
|
|
98
99
|
private m_touch_time: number;
|
|
99
100
|
private m_touch_count: number;
|
|
101
|
+
|
|
102
|
+
private m_router: Router;
|
|
100
103
|
|
|
101
104
|
constructor( props : P ) {
|
|
102
105
|
console.assert( Application.self===null, 'application is a singleton' );
|
|
@@ -112,8 +115,9 @@ export class Application<P extends ApplicationProps = ApplicationProps, E extend
|
|
|
112
115
|
|
|
113
116
|
this.m_touch_time = 0;
|
|
114
117
|
this.m_touch_count = 0;
|
|
118
|
+
this.m_router = null;
|
|
115
119
|
|
|
116
|
-
(Application.self as any) = this;
|
|
120
|
+
x4app = (Application.self as any) = this;
|
|
117
121
|
|
|
118
122
|
if( 'onload' in globalThis ) {
|
|
119
123
|
globalThis.addEventListener( 'load', ( ) => {
|
|
@@ -129,6 +133,13 @@ export class Application<P extends ApplicationProps = ApplicationProps, E extend
|
|
|
129
133
|
this.setTitle( '' );
|
|
130
134
|
}
|
|
131
135
|
|
|
136
|
+
public get router( ) {
|
|
137
|
+
if( !this.m_router ) {
|
|
138
|
+
this.m_router = new Router( );
|
|
139
|
+
}
|
|
140
|
+
return this.m_router;
|
|
141
|
+
}
|
|
142
|
+
|
|
132
143
|
public get app_name( ) {
|
|
133
144
|
return this.m_app_name;
|
|
134
145
|
}
|
|
@@ -247,5 +258,5 @@ export class Application<P extends ApplicationProps = ApplicationProps, E extend
|
|
|
247
258
|
}
|
|
248
259
|
};
|
|
249
260
|
|
|
250
|
-
|
|
261
|
+
export let x4app: Application;
|
|
251
262
|
|
package/lib/src/router.ts
CHANGED
|
@@ -156,6 +156,10 @@ export class Router extends EventSource< RouterEventMap > {
|
|
|
156
156
|
|
|
157
157
|
navigate( uri: string, notify = true ) {
|
|
158
158
|
|
|
159
|
+
if( !uri.startsWith('/') ) {
|
|
160
|
+
uri = '/'+uri;
|
|
161
|
+
}
|
|
162
|
+
|
|
159
163
|
const found = this._find( uri );
|
|
160
164
|
|
|
161
165
|
if( !found || found.handlers.length==0 ) {
|
package/lib/src/version.ts
CHANGED
|
@@ -30,6 +30,7 @@ import { EvMessage } from './x4events';
|
|
|
30
30
|
import { BaseComponent, BaseComponentEventMap, BaseComponentProps } from './base_component';
|
|
31
31
|
import { Component } from './component';
|
|
32
32
|
import { Settings } from './settings';
|
|
33
|
+
import { Router } from './router';
|
|
33
34
|
interface ApplicationEventMap extends BaseComponentEventMap {
|
|
34
35
|
message: EvMessage;
|
|
35
36
|
global: EvMessage;
|
|
@@ -77,8 +78,10 @@ export declare class Application<P extends ApplicationProps = ApplicationProps,
|
|
|
77
78
|
private m_user_data;
|
|
78
79
|
private m_touch_time;
|
|
79
80
|
private m_touch_count;
|
|
81
|
+
private m_router;
|
|
80
82
|
constructor(props: P);
|
|
81
83
|
ApplicationCreated(): void;
|
|
84
|
+
get router(): Router;
|
|
82
85
|
get app_name(): string;
|
|
83
86
|
get app_uid(): string;
|
|
84
87
|
get app_version(): string;
|
|
@@ -101,4 +104,5 @@ export declare class Application<P extends ApplicationProps = ApplicationProps,
|
|
|
101
104
|
enterModal(enter: boolean): void;
|
|
102
105
|
enableTouchDblClick(): void;
|
|
103
106
|
}
|
|
107
|
+
export declare let x4app: Application;
|
|
104
108
|
export {};
|
package/lib/types/version.d.ts
CHANGED