importServiceProviderfrom'sahara-service-provider';// register functionServiceProvider.register('foo',()=>{return'foo';});if(ServiceProvider.has('foo')){// call functionconstresult=ServiceProvider.call('foo');// or get functionconstfoo=ServiceProvider.get('foo');foo();}// unregister functionServiceProvider.unregister('foo');
importReact,{Component}from'react';importServiceProviderfrom'sahara-service-provider';classSayHelloButtonextendsComponent{render(){return(<buttononClick={this.clickHandler}>
Say Hello Button
</button>);}clickHandler(){ServiceProvider.call('sayHello','Hello!!!');}}exportdefaultSayHelloButton;