Provide mixin to easily integrate IResultCommand in vue.js using Neutronium. Component this mixin exposes:
Executes the given resultCommand passing the sacond argument as parameter and returns a promise;
To bind to C# ResultCommand property:
public class ViewModel
{
public IResultCommand ResultCommand {get;}
public ViewModel()
{
ResultCommand = RelayResultCommand.Create<string, int>(Count);
}
private int? Count(string routeName)
{
return routeName?.Length;
}
}
Do on javascript side:
import {toPromise} from 'neutronium-vue-resultcommand-topromise'
const promise = toPromise(viewModel.ResultCommand, 'countLetterNumber');
promise.then((ok)=>{
//Ok code
}, (error) =>{
//Error handling
})
- Available through:
npm install neutronium-vue-resultcommand-topromise --save