It looks good. For the record, I did: 
    
    
    import jsffi
    ...
    proc crossfilter*(a:seq[JsObject]): Crossfilter {.importc:"crossfilter".}
    ...
    
    
    Run

and 
    
    
    import crossfilter, jsffi
    
    let data = @[
      js{ name: "Rusty",  type: "human", legs: 2 },
      js{ name: "Alex",   type: "human", legs: 2 },
      js{ name: "Lassie", type: "dog",   legs: 4 },
      js{ name: "Spot",   type: "dog",   legs: 4 },
      js{ name: "Polly",  type: "bird",  legs: 2 },
      js{ name: "Fiona",  type: "plant", legs: 0 }
    ]
    
    
    Run

I have another question for the other functions. Given that `crossfilter` is 
defined in the JS world like:
    
    
      var crossfilter = {
        add: add,
        remove: removeData,
        dimension: dimension,
        groupAll: groupAll,
        size: size,
        all: all,
        allFiltered: allFiltered,
        onChange: onChange,
        isElementFiltered: isElementFiltered
      };
    
    
    Run

Should I do something like:
    
    
    Crossfilter* {.importc.} = object of RootObj
        add*: proc (this:JsObject)
        remove*: proc (this:Crossfilter)
        dimension*: proc (this:Crossfilter)
        groupAll*: proc (this:Crossfilter)
    ...
    
    
    Run

or it should be something like what I was doing at the beginning?
    
    
    proc groupAll*(a:Crossfilter):Crossfilter {.importc:"crossfilter.groupAll".}
    
    
    Run

Reply via email to