File tree Expand file tree Collapse file tree 3 files changed +70
-0
lines changed
tests/automation/show_devtool_after_http_server_created_in_node_main Expand file tree Collapse file tree 3 files changed +70
-0
lines changed Original file line number Diff line number Diff line change
1
+ < html >
2
+ < head >
3
+ </ head >
4
+ < body >
5
+ < script >
6
+ var gui = require ( 'nw.gui' ) ;
7
+ //gui.Window.get().show();
8
+
9
+
10
+ function showDevTool ( ) {
11
+ gui . Window . get ( ) . showDevTools ( ) ;
12
+ }
13
+ var result = {
14
+ success : false
15
+ } ;
16
+
17
+ var client = require ( 'net' ) . connect ( { port : 13013 } ) ;
18
+ setTimeout ( function ( ) {
19
+ client . end ( JSON . stringify ( result ) ) ;
20
+ } , 1100 ) ;
21
+
22
+ client . auto = true ;
23
+
24
+ if ( client . auto ) {
25
+ showDevTool ( ) ;
26
+ }
27
+ //if nw desn't close by itself,
28
+ //the value of result will be 'ok'
29
+ setTimeout ( function ( ) {
30
+ result . success = true ;
31
+ } , 800 ) ;
32
+
33
+
34
+ //we set show=false
35
+ //so we hope it can be show when we run it by hard.
36
+ if ( ! client . auto ) {
37
+ gui . Window . get ( ) . show ( ) ;
38
+ }
39
+
40
+
41
+
42
+
43
+ </ script >
44
+ < p > nw rocks !</ p >
45
+ < p > after launch devtool, nw should not close by itself.</ p >
46
+ < button onclick ="showDevTool() "> open devtool</ button >
47
+
48
+ </ body >
49
+ </ html >
Original file line number Diff line number Diff line change
1
+ var http = require ( 'http' ) ;
2
+ http . createServer ( function ( req , res ) {
3
+ res . writeHead ( 200 , { 'Content-Type' : 'text/plain' } ) ;
4
+ res . end ( 'Hello World\n' ) ;
5
+ } ) . listen ( 11337 , '127.0.0.1' ) ;
6
+
7
+ console . log ( 'Server running at http://127.0.0.1:1337/' ) ;
Original file line number Diff line number Diff line change
1
+ {
2
+ "name" : " server" ,
3
+ "description" : " server" ,
4
+ "version" : " 0.1" ,
5
+ "nodejs" :true ,
6
+ "node-main" : " main.js" ,
7
+ "main" : " index.html" ,
8
+ "window" : {
9
+ "show" : true ,
10
+ "toolbar" : true ,
11
+ "fullscreen" :false
12
+
13
+ }
14
+ }
You can’t perform that action at this time.
0 commit comments