x4js 1.4.18 → 1.4.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.
Files changed (124) hide show
  1. package/README.md +4 -3
  2. package/lib/application.d.ts +1 -1
  3. package/lib/application.js +4 -3
  4. package/lib/base_component.d.ts +1 -1
  5. package/lib/base_component.js +3 -3
  6. package/lib/button.d.ts +1 -1
  7. package/lib/button.js +3 -3
  8. package/lib/calendar.d.ts +1 -1
  9. package/lib/calendar.js +5 -4
  10. package/lib/canvas.d.ts +1 -1
  11. package/lib/canvas.js +2 -2
  12. package/lib/cardview.d.ts +1 -1
  13. package/lib/cardview.js +2 -2
  14. package/lib/checkbox.d.ts +1 -1
  15. package/lib/checkbox.js +2 -2
  16. package/lib/colorpicker.d.ts +1 -1
  17. package/lib/colorpicker.js +5 -5
  18. package/lib/combobox.d.ts +1 -1
  19. package/lib/combobox.js +3 -3
  20. package/lib/component.d.ts +1 -5
  21. package/lib/component.js +35 -39
  22. package/lib/datastore.d.ts +1 -1
  23. package/lib/datastore.js +5 -5
  24. package/lib/dialog.d.ts +1 -1
  25. package/lib/dialog.js +4 -3
  26. package/lib/drag_manager.js +30 -1
  27. package/lib/fileupload.js +2 -1
  28. package/lib/form.d.ts +1 -1
  29. package/lib/gridview.d.ts +1 -5
  30. package/lib/gridview.js +8 -7
  31. package/lib/i18n.d.ts +35 -33
  32. package/lib/i18n.js +180 -93
  33. package/lib/icon.d.ts +1 -1
  34. package/lib/icon.js +19 -16
  35. package/lib/image.js +4 -3
  36. package/lib/index.d.ts +1 -1
  37. package/lib/index.js +1 -1
  38. package/lib/input.js +1 -1
  39. package/lib/link.d.ts +1 -1
  40. package/lib/link.js +2 -2
  41. package/lib/listview.d.ts +1 -1
  42. package/lib/listview.js +10 -9
  43. package/lib/menu.d.ts +1 -1
  44. package/lib/menu.js +5 -4
  45. package/lib/popup.d.ts +1 -1
  46. package/lib/popup.js +13 -12
  47. package/lib/property_editor.d.ts +1 -1
  48. package/lib/property_editor.js +2 -2
  49. package/lib/radiobtn.d.ts +1 -1
  50. package/lib/radiobtn.js +4 -3
  51. package/lib/rating.d.ts +1 -1
  52. package/lib/rating.js +2 -2
  53. package/lib/router.d.ts +1 -1
  54. package/lib/router.js +5 -4
  55. package/lib/settings.js +2 -3
  56. package/lib/spreadsheet.d.ts +1 -1
  57. package/lib/spreadsheet.js +9 -8
  58. package/lib/styles.js +6 -5
  59. package/lib/svgcomponent.d.ts +1 -1
  60. package/lib/svgcomponent.js +4 -1
  61. package/lib/tabbar.d.ts +1 -1
  62. package/lib/tabbar.js +2 -2
  63. package/lib/textarea.d.ts +1 -1
  64. package/lib/textarea.js +2 -2
  65. package/lib/textedit.d.ts +1 -1
  66. package/lib/textedit.js +5 -4
  67. package/lib/tools.d.ts +1 -0
  68. package/lib/tools.js +15 -6
  69. package/lib/tooltips.js +6 -5
  70. package/lib/treeview.d.ts +1 -1
  71. package/lib/treeview.js +8 -8
  72. package/lib/x4dom.d.ts +49 -0
  73. package/lib/x4dom.js +32 -0
  74. package/lib/x4events.d.ts +266 -0
  75. package/lib/x4events.js +389 -0
  76. package/package.json +4 -3
  77. package/src/application.ts +5 -4
  78. package/src/base_component.ts +1 -1
  79. package/src/button.ts +1 -1
  80. package/src/calendar.ts +5 -3
  81. package/src/canvas.ts +1 -1
  82. package/src/cardview.ts +1 -1
  83. package/src/checkbox.ts +1 -1
  84. package/src/colorpicker.ts +1 -1
  85. package/src/combobox.ts +1 -1
  86. package/src/component.ts +34 -39
  87. package/src/datastore.ts +1 -1
  88. package/src/dialog.ts +4 -2
  89. package/src/drag_manager.ts +4 -1
  90. package/src/fileupload.ts +2 -1
  91. package/src/form.ts +1 -1
  92. package/src/gridview.ts +4 -3
  93. package/src/i18n.ts +234 -97
  94. package/src/icon.ts +18 -16
  95. package/src/image.ts +5 -3
  96. package/src/index.ts +1 -1
  97. package/src/input.ts +1 -1
  98. package/src/layout.ts +1 -1
  99. package/src/link.ts +1 -1
  100. package/src/listview.ts +6 -4
  101. package/src/menu.ts +5 -3
  102. package/src/popup.ts +14 -12
  103. package/src/property_editor.ts +1 -1
  104. package/src/radiobtn.ts +4 -2
  105. package/src/rating.ts +1 -1
  106. package/src/router.ts +4 -2
  107. package/src/settings.ts +2 -4
  108. package/src/smartedit.ts +3 -2
  109. package/src/spreadsheet.ts +8 -6
  110. package/src/styles.ts +7 -5
  111. package/src/svgcomponent.ts +4 -1
  112. package/src/tabbar.ts +1 -1
  113. package/src/textarea.ts +1 -1
  114. package/src/textedit.ts +4 -2
  115. package/src/tools.ts +15 -5
  116. package/src/tooltips.ts +7 -5
  117. package/src/treeview.ts +1 -1
  118. package/src/x4dom.ts +57 -0
  119. package/src/{x4_events.ts → x4events.ts} +1 -1
  120. package/tsconfig.json +5 -3
  121. package/src/hosts/electron.ts +0 -161
  122. package/src/hosts/host.ts +0 -100
  123. package/src/hosts/nwjs.ts +0 -141
  124. package/src/hosts/nwjs_types.ts +0 -339
package/src/tooltips.ts CHANGED
@@ -27,6 +27,8 @@
27
27
  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28
28
  **/
29
29
 
30
+ import { x4document } from './x4dom'
31
+
30
32
  import { Component } from './component'
31
33
  import { Label } from './label'
32
34
  import { Icon } from './icon'
@@ -79,7 +81,7 @@ export class Tooltip extends Component {
79
81
  }
80
82
 
81
83
  // @TODO: this is a minimal overflow problem solution
82
- let rc = document.body.getBoundingClientRect(),
84
+ let rc = x4document.body.getBoundingClientRect(),
83
85
  rm = this.getBoundingRect();
84
86
 
85
87
  if (halign == 'r') {
@@ -163,7 +165,7 @@ export function initTooltips(cb?: TooltipHandler) {
163
165
 
164
166
  if (tooltip === undefined) {
165
167
  tooltip = new Tooltip({});
166
- document.body.appendChild(tooltip._build());
168
+ x4document.body.appendChild(tooltip._build());
167
169
  }
168
170
 
169
171
  tooltip.text = tip;
@@ -183,7 +185,7 @@ export function initTooltips(cb?: TooltipHandler) {
183
185
  }
184
186
  }
185
187
 
186
- document.body.addEventListener('mouseover', handle_mouse);
187
- document.body.addEventListener('mouseout', handle_mouse);
188
- document.body.addEventListener('mousemove', handle_mpos);
188
+ x4document.body.addEventListener('mouseover', handle_mouse);
189
+ x4document.body.addEventListener('mouseout', handle_mouse);
190
+ x4document.body.addEventListener('mousemove', handle_mpos);
189
191
  }
package/src/treeview.ts CHANGED
@@ -32,7 +32,7 @@ import { HtmlString, Rect } from './tools';
32
32
  import { Icon, IconID } from './icon';
33
33
  import { Label } from './label';
34
34
  import { HLayout, VLayout } from './layout';
35
- import { EvClick, BasicEvent, EvDrag, EvSelectionChange, EvContextMenu } from './x4_events';
35
+ import { EvClick, BasicEvent, EvDrag, EvSelectionChange, EvContextMenu } from './x4events';
36
36
 
37
37
  export interface EvExpand extends BasicEvent {
38
38
  node: TreeNode;
package/src/x4dom.ts ADDED
@@ -0,0 +1,57 @@
1
+ /**
2
+ * ___ ___ __
3
+ * \ \_/ / / _
4
+ * \ / /_| |_
5
+ * / _ \____ _|
6
+ * /__/ \__\ |_|
7
+ *
8
+ * @file x4events.ts
9
+ * @author Etienne Cochard
10
+ *
11
+ * Copyright (c) 2019-2022 R-libre ingenierie
12
+ *
13
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
14
+ * of this software and associated documentation files (the "Software"), to deal
15
+ * in the Software without restriction, including without limitation the rights
16
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
17
+ * of the Software, and to permit persons to whom the Software is furnished to do so,
18
+ * subject to the following conditions:
19
+ * The above copyright notice and this permission notice shall be included in all copies
20
+ * or substantial portions of the Software.
21
+ *
22
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
23
+ * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
24
+ * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
25
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
26
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
27
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28
+ **/
29
+
30
+ /**
31
+ * SSR preparation
32
+ */
33
+
34
+ interface IX4Document {
35
+ createElement<K extends keyof HTMLElementTagNameMap>(tagName: K, options?: ElementCreationOptions): HTMLElementTagNameMap[K];
36
+ createElementNS(namespace: string | null, qualifiedName: string, options?: string | ElementCreationOptions): Element;
37
+ createTextNode(data: string): Text;
38
+
39
+ addEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
40
+ removeEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
41
+
42
+ querySelectorAll<E extends Element = Element>(selectors: string): NodeListOf<E>;
43
+ querySelector<E extends Element = Element>(selectors: string): E | null;
44
+
45
+ get body( ) : HTMLElement;
46
+ get activeElement( ): Element;
47
+ get location( ): Location;
48
+ get styleSheets( ): StyleSheetList;
49
+ get head( ): HTMLHeadElement;
50
+ get documentElement( ): HTMLElement;
51
+
52
+ set title( title: string );
53
+ }
54
+
55
+
56
+ export let x4document: IX4Document = document;
57
+
@@ -5,7 +5,7 @@
5
5
  * / _ \____ _|
6
6
  * /__/ \__\ |_|
7
7
  *
8
- * @file observable.ts
8
+ * @file x4events.ts
9
9
  * @author Etienne Cochard
10
10
  *
11
11
  * Copyright (c) 2019-2022 R-libre ingenierie
package/tsconfig.json CHANGED
@@ -13,9 +13,11 @@
13
13
  "./src/*",
14
14
  ],
15
15
  "exclude": [
16
- "src/hosts/nwjs_types.ts",
17
- "src/hosts/nwjs.ts",
18
16
  "src/texthiliter.ts",
19
17
  "src/smartedit.ts"
20
- ]
18
+ ],
19
+ "typedocOptions": {
20
+ "entryPoints": ["src/index.ts"],
21
+ "out": "../doc/api"
22
+ }
21
23
  }
@@ -1,161 +0,0 @@
1
- /**
2
- * @file host/electron.ts
3
- * @author Etienne Cochard
4
- * @license
5
- * Copyright (c) 2019-2021 R-libre ingenierie
6
- *
7
- * This program is free software; you can redistribute it and/or modify
8
- * it under the terms of the GNU General Public License as published by
9
- * the Free Software Foundation; either version 3 of the License, or
10
- * (at your option) any later version.
11
- *
12
- * This program is distributed in the hope that it will be useful,
13
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
- * GNU General Public License for more details.
16
- *
17
- * You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
18
- **/
19
-
20
- import { FileStat, PathType, PartType, Host } from './host'
21
-
22
- export * from './host';
23
-
24
- declare const host_require;
25
- if( !globalThis.host_require ) {
26
- globalThis.host_require = require;
27
- }
28
-
29
- export const fs = host_require( 'fs' );
30
- export const process = host_require( 'process' );
31
- export const electron = host_require( 'electron' );
32
- export const path = host_require( 'path' );
33
-
34
- //import * as path from 'node:path';
35
-
36
- export class ElectronHost extends Host {
37
-
38
- makePath( ...els: string[] ) {
39
- return path.join( ...els );
40
- }
41
-
42
- readBinary( path: string ): Promise<Uint8Array> {
43
- return new Promise( ( resolve, reject ) => {
44
- fs.readFile( path, ( err, buff ) => {
45
- if( err ) { reject( err ); }
46
- else { resolve( buff ); }
47
- } );
48
- } );
49
- }
50
-
51
- writeBinary( path: string, data: Uint8Array ): Promise<boolean> {
52
- return new Promise( ( resolve, reject ) => {
53
- fs.writeFile( path, data, ( err ) => {
54
- if( err ) { reject(err); }
55
- else { resolve( true ); }
56
- } );
57
- } );
58
- }
59
-
60
- readUtf8( path: string ): Promise<string> {
61
- return new Promise( ( resolve, reject ) => {
62
- fs.readFile( path, { encoding: 'utf8' }, ( err, buff ) => {
63
- if( err ) { reject( err ); }
64
- else { resolve( buff.toString() ); }
65
- } );
66
- } );
67
- }
68
-
69
- writeUtf8( path: string, data: string ): Promise<boolean> {
70
- return new Promise( ( resolve, reject ) => {
71
- fs.writeFile( path, data, {encoding: 'utf8'}, ( err ) => {
72
- if( err ) { reject(err); }
73
- else { resolve( true ); }
74
- } );
75
- } );
76
- }
77
-
78
- compress( data: Uint8Array ): Promise<Uint8Array> {
79
- return new Promise( (resolve, reject ) => {
80
- let zlib = this.require('zlib');
81
- zlib.gzip( data, ( err, Uint8Array ) => {
82
- if( err ) { reject( err); }
83
- else { resolve( Uint8Array); }
84
- } );
85
- } );
86
- }
87
-
88
- decompress( data: Uint8Array ): Promise<Uint8Array> {
89
- return new Promise( (resolve, reject ) => {
90
- let zlib = this.require('zlib');
91
- zlib.gunzip( data, ( err, Uint8Array ) => {
92
- if( err ) { reject( err); }
93
- else { resolve( Uint8Array); }
94
- } );
95
- } );
96
- }
97
-
98
- readLocalStorage( name: string ): string {
99
- return localStorage.getItem( name );
100
- }
101
-
102
- writeLocalStorage( name: string, data: string ): void {
103
- localStorage.setItem( name, data );
104
- }
105
-
106
- stat( name: string ): FileStat {
107
- let stat = fs.statSync( name );
108
- if( !stat ) {
109
- return null;
110
- }
111
-
112
- return {
113
- atime: stat.atimeMs,
114
- isDir: stat.isDirectory()
115
- }
116
- }
117
-
118
- readDir( path: string ): Promise<string[]> {
119
- return new Promise( ( resolve, reject ) => {
120
- fs.readdir( path, ( err, files ) => {
121
- if( err ) { reject(err); }
122
- else { resolve(files); }
123
- });
124
- });
125
- }
126
-
127
- require( name: string ): any {
128
- return host_require( name );
129
- }
130
-
131
- cwd( ): string {
132
- return process.cwd( );
133
- }
134
-
135
- get ipc( ) {
136
- return electron.ipcRenderer;
137
- }
138
-
139
- getPath( type: PathType ) : string {
140
- return this.ipc.sendSync( 'getPath', type );
141
- }
142
-
143
- getPathPart( pth: string, type: PartType ) : string {
144
-
145
- let els = path.parse( pth );
146
- switch ( type ) {
147
- case 'dirname': return els.dir;
148
- case 'basename': return els.base;
149
- case 'filename': return els.name;
150
- case 'extname': return els.ext;
151
- }
152
-
153
- return '';
154
- }
155
-
156
- createCanvas = ( ) => {
157
- return document.createElement('canvas');
158
- }
159
- }
160
-
161
- new ElectronHost( );
package/src/hosts/host.ts DELETED
@@ -1,100 +0,0 @@
1
- /**
2
- * @file host.ts
3
- * @author Etienne Cochard
4
- * @license
5
- * Copyright (c) 2019-2021 R-libre ingenierie
6
- *
7
- * This program is free software; you can redistribute it and/or modify
8
- * it under the terms of the GNU General Public License as published by
9
- * the Free Software Foundation; either version 3 of the License, or
10
- * (at your option) any later version.
11
- *
12
- * This program is distributed in the hope that it will be useful,
13
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
- * GNU General Public License for more details.
16
- *
17
- * You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
18
- **/
19
-
20
- export interface FileStat {
21
- atime: number;
22
- isDir: boolean;
23
- }
24
-
25
- export type PathType = 'home' | 'appData' | 'userData' | 'cache' | 'temp' | 'exe' | 'desktop' | 'documents' | 'downloads' | 'music'
26
- | 'pictures'| 'videos' | 'recent' | 'logs' | 'crashDumps';
27
-
28
- export type PartType = 'filename' | 'extname' | 'basename' | 'dirname';
29
-
30
- export abstract class Host {
31
-
32
- constructor( ) {
33
- host = this;
34
- }
35
-
36
- makePath( ...els: string[] ) {
37
- return els.join( '/' );
38
- }
39
-
40
- readBinary( path: string ): Promise<Uint8Array> {
41
- return Promise.reject( 'not imp' );
42
- }
43
-
44
- writeBinary( path: string, data: Uint8Array ): Promise<boolean> {
45
- return Promise.reject( 'not imp' );
46
- }
47
-
48
- readUtf8( path: string ): Promise<string> {
49
- return Promise.reject( 'not imp' );
50
- }
51
-
52
- writeUtf8( path: string, data: string ): Promise<boolean> {
53
- return Promise.reject( 'not imp' );
54
- }
55
-
56
- compress( data: Uint8Array ): Promise<Uint8Array> {
57
- return Promise.reject( 'not imp' );
58
- }
59
-
60
- decompress( data: Uint8Array ): Promise<Uint8Array> {
61
- return Promise.reject( 'not imp' );
62
- }
63
-
64
- readLocalStorage( name: string ): string {
65
- return localStorage.getItem( name );
66
- }
67
-
68
- writeLocalStorage( name: string, data: string ): void {
69
- localStorage.setItem( name, data );
70
- }
71
-
72
- stat( name: string ): FileStat {
73
- throw 'not imp';
74
- }
75
-
76
- readDir( path: string ): Promise<string[]> {
77
- throw 'not imp';
78
- }
79
-
80
- require( name: string ): any {
81
- throw 'not imp';
82
- }
83
-
84
- cwd( ): string {
85
- throw 'not imp';
86
- }
87
-
88
- getPath( type: PathType ) : string {
89
- throw 'not imp';
90
- }
91
-
92
- getPathPart( path: string, type: PartType ) : string {
93
- throw 'not imp';
94
- }
95
-
96
- abstract createCanvas( );
97
- }
98
-
99
-
100
- export let host: Host = null;
package/src/hosts/nwjs.ts DELETED
@@ -1,141 +0,0 @@
1
- /**
2
- * @file host/nwjs.ts
3
- * @author Etienne Cochard
4
- * @license
5
- * Copyright (c) 2019-2021 R-libre ingenierie
6
- *
7
- * This program is free software; you can redistribute it and/or modify
8
- * it under the terms of the GNU General Public License as published by
9
- * the Free Software Foundation; either version 3 of the License, or
10
- * (at your option) any later version.
11
- *
12
- * This program is distributed in the hope that it will be useful,
13
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
- * GNU General Public License for more details.
16
- *
17
- * You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
18
- **/
19
-
20
- import { FileStat, PathType, Host } from './host'
21
-
22
- export * from './host';
23
-
24
- // to deal with amd modules (that are not comletely compatible with nodejs)
25
- // globalThis.node_require must be set to require BEFORE polyfill code of amd module.
26
- // ie. globalThis.node_require = require;
27
-
28
- declare const host_require;
29
- if( !globalThis.host_require ) {
30
- globalThis.host_require = require;
31
- }
32
-
33
- const fs = host_require( 'fs' );
34
- const process = host_require( 'process' );
35
- const path = host_require( 'path' );
36
-
37
-
38
-
39
- export class NWJSHost implements Host {
40
-
41
- makePath( ...els: string[] ) {
42
- return path.join( ...els );
43
- }
44
-
45
- readBinary( path: string ): Promise<Uint8Array> {
46
- return new Promise( ( resolve, reject ) => {
47
- fs.readFile( path, ( err, buff ) => {
48
- if( err ) { reject( err ); }
49
- else { resolve( buff ); }
50
- } );
51
- } );
52
- }
53
-
54
- writeBinary( path: string, data: Uint8Array ): Promise<boolean> {
55
- return new Promise( ( resolve, reject ) => {
56
- fs.writeFile( path, data, ( err ) => {
57
- if( err ) { reject(err); }
58
- else { resolve( true ); }
59
- } );
60
- } );
61
- }
62
-
63
- readUtf8( path: string ): Promise<string> {
64
- return new Promise( ( resolve, reject ) => {
65
- fs.readFile( path, { encoding: 'utf8' }, ( err, buff ) => {
66
- if( err ) { reject( err ); }
67
- else { resolve( buff.toString() ); }
68
- } );
69
- } );
70
- }
71
-
72
- writeUtf8( path: string, data: string ): Promise<boolean> {
73
- return new Promise( ( resolve, reject ) => {
74
- fs.writeFile( path, data, {encoding: 'utf8'}, ( err ) => {
75
- if( err ) { reject(err); }
76
- else { resolve( true ); }
77
- } );
78
- } );
79
- }
80
-
81
- compress( data: Uint8Array ): Promise<Uint8Array> {
82
- return new Promise( (resolve, reject ) => {
83
- let zlib = host_require('zlib');
84
- zlib.gzip( data, ( err, Uint8Array ) => {
85
- if( err ) { reject( err); }
86
- else { resolve( Uint8Array); }
87
- } );
88
- } );
89
- }
90
-
91
- decompress( data: Uint8Array ): Promise<Uint8Array> {
92
- return new Promise( (resolve, reject ) => {
93
- let zlib = host_require('zlib');
94
- zlib.gunzip( data, ( err, Uint8Array ) => {
95
- if( err ) { reject( err); }
96
- else { resolve( Uint8Array); }
97
- } );
98
- } );
99
- }
100
-
101
- readLocalStorage( name: string ): string {
102
- return localStorage.getItem( name );
103
- }
104
-
105
- writeLocalStorage( name: string, data: string ): void {
106
- localStorage.setItem( name, data );
107
- }
108
-
109
- stat( name: string ): FileStat {
110
- let stat = fs.statSync( name );
111
- if( !stat ) {
112
- return null;
113
- }
114
-
115
- return {
116
- atime: stat.atimeMs
117
- }
118
- }
119
-
120
- readDir( path: string ): Promise<string[]> {
121
- return new Promise( ( resolve, reject ) => {
122
- fs.readdir( path, ( err, files ) => {
123
- if( err ) { reject(err); }
124
- else { resolve(files); }
125
- });
126
- });
127
- }
128
-
129
- require( name: string ): any {
130
- // your amd module must define window.node_require = require;
131
- return host_require( name );
132
- }
133
-
134
- cwd( ): string {
135
- return process.cwd( );
136
- }
137
-
138
- getPath( type: PathType ) : string {
139
- throw 'not imp';
140
- }
141
- }