Skip to content

Commit

Permalink
Fix MyFirstContext example by remapping our command binder to events
Browse files Browse the repository at this point in the history
  • Loading branch information
WillzZz committed Dec 9, 2017
1 parent cae5373 commit e4cb4d8
Showing 1 changed file with 13 additions and 1 deletion.
Expand Up @@ -16,6 +16,8 @@
/// sequence is complete.

using System;
using strange.extensions.command.api;
using strange.extensions.command.impl;
using UnityEngine;
using strange.extensions.context.api;
using strange.extensions.context.impl;
Expand Down Expand Up @@ -47,14 +49,24 @@ protected override void mapBindings()
//and to/from the App. This keeps dependencies between the view and the app
//separated.
mediationBinder.Bind<ExampleView>().To<ExampleMediator>();



//Event/Command binding
commandBinder.Bind(ExampleEvent.REQUEST_WEB_SERVICE).To<CallWebServiceCommand>();
//The START event is fired as soon as mappings are complete.
//Note how we've bound it "Once". This means that the mapping goes away as soon as the command fires.
commandBinder.Bind(ContextEvent.START).To<StartCommand>().Once ();

}


//You can safely ignore this bit. Since changing our default to Signals from Events, this is now necessary in this example.
protected override void addCoreComponents()
{
base.addCoreComponents();
injectionBinder.Unbind<ICommandBinder>(); //Unbind to avoid a conflict!
injectionBinder.Bind<ICommandBinder>().To<EventCommandBinder>().ToSingleton();
}
}
}

0 comments on commit e4cb4d8

Please sign in to comment.