Next version of Durandal could be Caliburn.Micro

60 views
Skip to first unread message

Anders Malmgren

unread,
Mar 31, 2015, 7:45:41 AM3/31/15
to duran...@googlegroups.com
I have spent the last few days testing and POCing this framework, http://duoco.de/. There is also a open source counterpart here https://github.com/kswoll/WootzJs

DuoCode compiles C# to Javascript with basically full runtime support like reflection which opens up possibilities to use Type conventions over configuration and Interface injection using IoC

I have succesfully created a Binding for Knockout, next step is to create a Binding and Viewlocator for Durandal. 

I have created a Binding for most of the Basic functions of knockout and after that stuff lk

using Knockout;


namespace ViewModels
{
   
public class FooViewModel
   
{
           
private readonly Observable<string> bar;        
           
private readonly Observable<string> computed;  
           
private readonly Observable<int> numbers;        


       
public FooViewModel()
       
{
            bar
= Global.Observable("HelloWorld");
            computed
= Global.Computed(() => bar.Get() + "COMPUTED");
            numbers
= Global.ObservableArray(new[] { 1,4,3,5 }); //Generic arrays as params like this is not yet possible due to a bug that I have filed a ticker for

            numbers
.Remove(i => i == 4); //All functions of Obs.array are bound
            bar
.Subscribe(System.Console.WriteLine); //Translate to console.log on client
       
}


       
public Observable<string> Bar { get { return bar; } }
       
public Observable<string> Computed { get { return computed; } }
   
}
}

Next version of Durandal might be a exakt clone of Caliburn.Micro :D

Anders Malmgren

unread,
Apr 7, 2015, 4:46:16 PM4/7/15
to duran...@googlegroups.com
I've been playing around with DuoCode for the past days and I have created a DuoCode binding for my Convention Over config extension called Knockout.BindingConventions

I have managed to get Type based View locator working and even cooler the Coroutine mechanism from Caliburn Micro

You can now have a method like this in your VM

        public IEnumerable<IResult> Click()
       
{
           
yield return new AlertResult("Clicked!");
       
}

Coupled with html (Nothing new here this is all done by library)
<button data-name="Click">Click me</button>

And some IResult implementation
    public class AlertResult : IResult
   
{
       
private readonly string alert;


       
public AlertResult(string alert)
       
{
           
this.alert = alert;
       
}


       
public void Execute(ResultContext context)
       
{
           
DuoCode.Dom.Global.window.alert(alert);
       
}
   
}

I'm also working on a SimpleInjector that will be able to constructor inject types based on Interface types
Reply all
Reply to author
Forward
0 new messages