Skip to content

Instantly share code, notes, and snippets.

@gaperton
Created March 3, 2016 22:12
Show Gist options
  • Save gaperton/e8704db13dcd9e214154 to your computer and use it in GitHub Desktop.
Save gaperton/e8704db13dcd9e214154 to your computer and use it in GitHub Desktop.
function State1( a, b ){
this.a = a;
this.b = b;
}
State1.prototype.msgType1 = function( c, d ){
return new State2( this.a + 1 );
}
State1.prototype.msgType2 = function( d ){
return new State1( this.a, d );
}
function State2( z ){
this.z = z;
}
State2.prototype.backMsg = function(){
return new State1( );
}
@jt3k
Copy link

jt3k commented Mar 4, 2016

Поясните этот код. не совсем понял

  • для чего new State1( ); внутри backMsg.
  • аргументы у метода msgType1
  • какой реальный юзкейс этого всего ?

Попытка перенести в жс что-то с бекенда ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment