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

Commit5394724

Browse files
committed
Enable method chaining for static methods as well
1 parent1998c19 commit5394724

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

‎package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name":"algorithm-visualizer",
3-
"version":"2.3.0",
3+
"version":"2.3.1",
44
"description":"Visualization Library for JavaScript",
55
"keywords": [
66
"algorithm",

‎src/Commander.ts‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class Commander {
1414
privatestaticobjectCount=0;
1515
publicstaticcommands:Command[]=[];
1616

17-
staticcommand(key:string|null,method:string,iArguments:IArguments):void{
17+
staticcommand(key:string|null,method:string,iArguments:IArguments):Commander{
1818
constargs=Array.from(iArguments);
1919
this.commands.push({
2020
key,
@@ -23,14 +23,15 @@ class Commander {
2323
});
2424
if(this.commands.length>MAX_COMMANDS)thrownewError('Too Many Commands');
2525
if(this.objectCount>MAX_OBJECTS)thrownewError('Too Many Objects');
26+
return(<any>this);
2627
}
2728

28-
staticsetRoot(child:Commander){
29-
this.command(null,'setRoot',arguments);
29+
staticsetRoot(child:Commander):Commander{
30+
returnthis.command(null,'setRoot',arguments);
3031
}
3132

32-
staticdelay(lineNumber?:Number){
33-
this.command(null,'delay',arguments);
33+
staticdelay(lineNumber?:Number):Commander{
34+
returnthis.command(null,'delay',arguments);
3435
}
3536

3637
privatereadonlykey:string;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp