Skip to content

Commit

Permalink
Update v0.7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jc3213 authored Aug 19, 2024
1 parent 1f8cf05 commit 6718829
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions archived/aria2_0.7.0.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ class Aria2 {
constructor (...args) {
let path = args.join('#').match(/^(https?|wss?)(?:#|:\/\/)([^#]+)#?(.*)$/);
if (!path) { throw new Error('Invalid JSON-RPC entry: "' + args.join('", "') + '"'); }
this.jsonrpc = {};
this.timeout = this.retry = 10;
this.scheme = path[1];
this.url = path[2];
this.secret = path[3];
this.retry = this.timeout = 10;
this.onmessage = this.onclose = null;
}
version = '0.7.0';
jsonrpc = {};
set scheme (scheme) {
this.call = { 'http': this.post, 'https': this.post, 'ws': this.send, 'wss': this.send }[ scheme ];
if (!this.call) { throw new Error('Invalid JSON-RPC scheme: "' + scheme + '" is not supported!'); }
Expand All @@ -36,7 +36,7 @@ class Aria2 {
return this.jsonrpc.secret;
}
set retry (number) {
this.jsonrpc.retry = number;
this.jsonrpc.retry = number === 0 ? Infinity : number;
this.jsonrpc.trial = 0;
}
get retry () {
Expand All @@ -58,7 +58,7 @@ class Aria2 {
response.method ? this.jsonrpc.onmessage(response) : ws.resolve(response);
};
ws.onclose = (event) => {
if (!event.wasClean && this.jsonrpc.trial < this.jsonrpc.retry) { console.log(this.jsonrpc.trial); setTimeout(() => this.connect(), this.jsonrpc.timeout); }
if (!event.wasClean && this.jsonrpc.trial < this.jsonrpc.retry) { setTimeout(() => this.connect(), this.jsonrpc.timeout); }
this.jsonrpc.onclose(event);
this.jsonrpc.trial ++;
};
Expand Down
8 changes: 4 additions & 4 deletions aria2.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ class Aria2 {
constructor (...args) {
let path = args.join('#').match(/^(https?|wss?)(?:#|:\/\/)([^#]+)#?(.*)$/);
if (!path) { throw new Error('Invalid JSON-RPC entry: "' + args.join('", "') + '"'); }
this.jsonrpc = {};
this.timeout = this.retry = 10;
this.scheme = path[1];
this.url = path[2];
this.secret = path[3];
this.retry = this.timeout = 10;
this.onmessage = this.onclose = null;
}
version = '0.7.0';
jsonrpc = {};
set scheme (scheme) {
this.call = { 'http': this.post, 'https': this.post, 'ws': this.send, 'wss': this.send }[ scheme ];
if (!this.call) { throw new Error('Invalid JSON-RPC scheme: "' + scheme + '" is not supported!'); }
Expand All @@ -36,7 +36,7 @@ class Aria2 {
return this.jsonrpc.secret;
}
set retry (number) {
this.jsonrpc.retry = number;
this.jsonrpc.retry = number === 0 ? Infinity : number;
this.jsonrpc.trial = 0;
}
get retry () {
Expand All @@ -58,7 +58,7 @@ class Aria2 {
response.method ? this.jsonrpc.onmessage(response) : ws.resolve(response);
};
ws.onclose = (event) => {
if (!event.wasClean && this.jsonrpc.trial < this.jsonrpc.retry) { console.log(this.jsonrpc.trial); setTimeout(() => this.connect(), this.jsonrpc.timeout); }
if (!event.wasClean && this.jsonrpc.trial < this.jsonrpc.retry) { setTimeout(() => this.connect(), this.jsonrpc.timeout); }
this.jsonrpc.onclose(event);
this.jsonrpc.trial ++;
};
Expand Down

0 comments on commit 6718829

Please sign in to comment.