Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit986c981

Browse files
author
zhourenjian
committed
Support delta *.js update to avoid re-downloading tons of *.js
Pack more *.js into fewer *.z.js to increase *.js loading
1 parent4119e86 commit986c981

File tree

2 files changed

+66
-49
lines changed

2 files changed

+66
-49
lines changed

‎sources/net.sf.j2s.java.core/src/java/lang/ClassLoader.js‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -558,6 +558,28 @@ ClazzLoader.registerPackages = function (prefix, pkgs) {
558558
*/
559559
/* protected */
560560
ClazzLoader.multipleSites=function(path){
561+
vardeltas=window["j2s.update.delta"];
562+
if(deltas!=null&&deltasinstanceofArray&&deltas.length>=3){
563+
varlastOldVersion=null;
564+
varlastNewVersion=null;
565+
for(vari=0;i<deltas.length/3;i++){
566+
varoldVersion=deltas[i+i+i];
567+
if(oldVersion!="$"){
568+
lastOldVersion=oldVersion;
569+
}
570+
varnewVersion=deltas[i+i+i+1];
571+
if(newVersion!="$"){
572+
lastNewVersion=newVersion;
573+
}
574+
varrelativePath=deltas[i+i+i+2];
575+
varkey=lastOldVersion+"/"+relativePath;
576+
varidx=path.indexOf(key);
577+
if(idx!=-1&&idx==path.length-key.length){
578+
path=path.substring(0,idx)+lastNewVersion+"/"+relativePath;
579+
break;
580+
}
581+
}
582+
}
561583
varlength=path.length;
562584
if(ClazzLoader.maxLoadingThreads>1
563585
&&((length>15&&path.substring(0,15)=="http://archive.")
@@ -1098,6 +1120,7 @@ ClazzLoader.loadScript = function (file) {
10981120
alert("[Java2Script] XMLHttpRequest not supported!");
10991121
return;
11001122
}
1123+
11011124
transport.open("GET",file,ClazzLoader.isAsynchronousLoading);
11021125
// transport.setRequestHeader ("User-Agent",
11031126
// "Java2Script-Pacemaker/1.0 (+http://j2s.sourceforge.net)");

‎sources/net.sf.j2s.java.core/src/java/package.js‎

Lines changed: 43 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,59 @@ window["java.registered"] = false;
1212

1313
varbase=ClazzLoader.getClasspathFor("java.*");
1414

15-
ClazzLoader.loadZJar(base+"error.z.js","java.lang.Throwable");
15+
//ClazzLoader.loadZJar (base + "error.z.js", "java.lang.Throwable");
1616
ClazzLoader.loadZJar(base+"core.z.js",ClazzLoader.runtimeKeyClass);//"java.lang.String"
1717

1818
ClazzLoader.jarClasspath(base+"core.z.js",[
19+
"java.lang.Void",
20+
"$.reflect.AccessibleObject",
21+
"$.AnnotatedElement",
22+
"$.GenericDeclaration",
23+
"$.InvocationHandler",
24+
"$.Member",
25+
"$.Modifier",
26+
"$.Constructor",
27+
"$.Field",
28+
"$.Method",
29+
1930
"java.net.URLEncoder",
2031
"java.net.URLDecoder",
2132

2233
"net.sf.j2s.ajax.HttpRequest",
2334
"$.ARunnable",
2435
"$.AClass",
2536
"$.ASWTClass",
37+
38+
"net.sf.j2s.ajax.IXHRCallback",
39+
"$.XHRCallbackAdapter",
40+
"$.XHRCallbackSWTAdapter",
41+
42+
"$.SimpleSerializable",
43+
"$.SimpleFilter",
44+
"$.SimpleRPCRunnable",
45+
"$.ISimpleRequestInfoBinding",
46+
"$.ISimpleRequestInfo",
47+
"$.ISimpleGeoLocationBinding",
48+
"$.ISimpleGeoLocation",
49+
"$.SimpleRPCRequest",
50+
"$.SimpleRPCSWTRequest",
51+
52+
"$.SimplePipeRunnable",
53+
"$.ISimplePipePriority",
54+
"$.SimplePipeHelper",
55+
"$.SimplePipeRequest",
56+
"$.SimplePipeSWTRequest",
57+
58+
"$.CompoundSerializable",
59+
"$.CompoundPipeSession",
60+
"$.CompoundPipeRunnable",
61+
"$.CompoundPipeRequest",
62+
"$.CompoundPipeSWTRequest",
63+
64+
"net.sf.j2s.store.IStore",
65+
"$.CookieStore",
66+
"$.XSSCookieStore",
67+
"$.SimpleStore"
2668
]);
2769

2870
ClazzLoader.jarClasspath(base+"util/AbstractList.js",[
@@ -78,54 +120,6 @@ window["java.registered"] = false;
78120
"java.util.Collections.UnmodifiableSortedSet"
79121
]);
80122

81-
ClazzLoader.jarClasspath(base+"lang/reflect.z.js",[
82-
"java.lang.Void",
83-
"$.reflect.AccessibleObject",
84-
"$.AnnotatedElement",
85-
"$.GenericDeclaration",
86-
"$.InvocationHandler",
87-
"$.Member",
88-
"$.Modifier",
89-
"$.Constructor",
90-
"$.Field",
91-
"$.Method"
92-
]);
93-
94-
varisDebugging=(window["ajax.debugging"]==true);
95-
if(!isDebugging){
96-
/* ajax library */
97-
ClazzLoader.jarClasspath(ClazzLoader.getClasspathFor("net.sf.j2s.ajax.*")+"simple.z.js",[
98-
"net.sf.j2s.ajax.IXHRCallback",
99-
"$.XHRCallbackAdapter",
100-
"$.XHRCallbackSWTAdapter",
101-
102-
"$.SimpleSerializable",
103-
"$.SimpleFilter",
104-
"$.SimpleRPCRunnable",
105-
"$.SimpleRPCRequest",
106-
"$.SimpleRPCSWTRequest",
107-
108-
"$.SimplePipeRunnable",
109-
"$.ISimplePipePriority",
110-
"$.SimplePipeHelper",
111-
"$.SimplePipeRequest",
112-
"$.SimplePipeSWTRequest",
113-
114-
"$.CompoundSerializable",
115-
"$.CompoundPipeSession",
116-
"$.CompoundPipeRunnable",
117-
"$.CompoundPipeRequest",
118-
"$.CompoundPipeSWTRequest"
119-
]);
120-
}
121-
122-
ClazzLoader.jarClasspath(ClazzLoader.getClasspathFor("net.sf.j2s.*")+"store.z.js",[
123-
"net.sf.j2s.store.IStore",
124-
"$.CookieStore",
125-
"$.XSSCookieStore",
126-
"$.SimpleStore"
127-
]);
128-
129123
ClazzLoader.jarClasspath(base+"lang/StringBuilder.z.js",
130124
["java.lang.AbstractStringBuilder","$.StringBuilder"]);
131125
base=base.substring(0,base.lastIndexOf("java/"));

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp