x4js 1.5.24 → 1.5.25

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.
@@ -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 'x4js'
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 ) {
@@ -27,4 +27,4 @@
27
27
  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28
28
  **/
29
29
 
30
- export const x4js_version = "1.5.24";
30
+ export const x4js_version = "1.5.25";
@@ -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 'x4js';
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 {};
@@ -26,4 +26,4 @@
26
26
  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
27
27
  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28
28
  **/
29
- export declare const x4js_version = "1.5.24";
29
+ export declare const x4js_version = "1.5.25";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "x4js",
3
- "version": "1.5.24",
3
+ "version": "1.5.25",
4
4
  "description": "X4js core files",
5
5
  "main": "lib/cjs/index.js",
6
6
  "types": "lib/types/index.d.ts",