1
+ <!DOCTYPE html>
2
+ < html >
3
+ < head >
4
+ < meta charset ="UTF-8 ">
5
+ < title > Pot.js + PotLite.js - Compiler - JavaScript Library</ title >
6
+ < script src ="pot.js "> </ script >
7
+ < script >
8
+ Pot . attach ( window , 'load' , function ( ) {
9
+ var BUILD_URL = 'build.php' ;
10
+ var MINIFY_URL = 'minify.php' ;
11
+
12
+ var log = function ( msg ) {
13
+ var status = document . getElementById ( 'status' ) ;
14
+ status . textContent += msg + '\n' ;
15
+ } ;
16
+
17
+ var script = {
18
+ full : '' ,
19
+ lite : '' ,
20
+ minify : {
21
+ full : '' ,
22
+ lite : ''
23
+ }
24
+ } ;
25
+
26
+ log ( '----------------------------' ) ;
27
+ log ( '[Begin] Compiling.' ) ;
28
+ log ( '----------------------------' ) ;
29
+
30
+ Pot . begin ( function ( ) {
31
+ log ( 'Request: ' + BUILD_URL + ': full' ) ;
32
+ return Pot . request ( BUILD_URL , {
33
+ queryString : {
34
+ debug : false ,
35
+ type : 'full'
36
+ }
37
+ } ) . then ( function ( res ) {
38
+ script . full = res . responseText ;
39
+ log ( Pot . sprintf ( 'full: %d bytes.' , Pot . utf8ByteOf ( script . full ) ) ) ;
40
+ } ) ;
41
+ } ) . wait ( 5 ) . speed ( 'slow' ) . then ( function ( ) {
42
+ log ( 'Request: ' + BUILD_URL + ': lite' ) ;
43
+ return Pot . request ( BUILD_URL , {
44
+ queryString : {
45
+ debug : false ,
46
+ type : 'lite'
47
+ }
48
+ } ) . then ( function ( res ) {
49
+ script . lite = res . responseText ;
50
+ log ( Pot . sprintf ( 'lite: %d bytes.' , Pot . utf8ByteOf ( script . lite ) ) ) ;
51
+ } ) ;
52
+ } ) . wait ( 5 ) . then ( function ( ) {
53
+ log ( 'Request: ' + MINIFY_URL + ': full' ) ;
54
+ return Pot . request ( MINIFY_URL , {
55
+ queryString : {
56
+ type : 'full'
57
+ }
58
+ } ) . then ( function ( res ) {
59
+ script . minify . full = res . responseText ;
60
+ log ( Pot . sprintf ( '[minify] full: %s' , script . minify . full ) ) ;
61
+ } ) ;
62
+ } ) . wait ( 3.5 ) . then ( function ( ) {
63
+ log ( 'Request: ' + MINIFY_URL + ': lite' ) ;
64
+ return Pot . request ( MINIFY_URL , {
65
+ queryString : {
66
+ type : 'lite'
67
+ }
68
+ } ) . then ( function ( res ) {
69
+ script . minify . lite = res . responseText ;
70
+ log ( Pot . sprintf ( '[minify] lite: %s' , script . minify . lite ) ) ;
71
+ } ) ;
72
+ } ) . wait ( 1 ) . then ( function ( ) {
73
+ log ( '----------------------------' ) ;
74
+ log ( '[End] Complete compiling.' ) ;
75
+ log ( '----------------------------' ) ;
76
+ } ) . end ( ) ;
77
+ } ) ;
78
+ </ script >
79
+ </ head >
80
+ < body >
81
+ < h1 > Pot.js - Compiler - JavaScript Library</ h1 >
82
+ < pre id ="status "> </ pre >
83
+ </ body >
84
+ </ html >
0 commit comments