File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed
Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -41,6 +41,24 @@ class ProxyController{
4141 this . policy . reset ( )
4242 }
4343}
44+ class MultiController {
45+ constructor ( Controller ) {
46+ this . Controller = Controller
47+ this . controllers = null
48+ }
49+ evaluate_step ( state ) {
50+ if ( this . controllers === null || this . controllers . length !== state . length ) {
51+ this . controllers = state . map ( ( ) => new this . Controller ( ) )
52+ }
53+ return state . map ( ( state , i ) => this . controllers [ i ] . evaluate_step ( state ) )
54+ }
55+ reset ( ) {
56+ if ( this . controllers === null ) {
57+ return
58+ }
59+ this . controllers . forEach ( controller => controller . reset ( ) )
60+ }
61+ }
4462
4563let model = null
4664class Policy {
@@ -211,7 +229,7 @@ async function main(){
211229 const url = URL . createObjectURL ( blob ) ;
212230 const Controller = ( await import ( url ) ) . default
213231 URL . revokeObjectURL ( url ) ;
214- proxy_controller . policy = new Controller ( )
232+ proxy_controller . policy = new MultiController ( Controller )
215233 window . controller = proxy_controller . policy
216234 }
217235 } )
You can’t perform that action at this time.
0 commit comments