quirkey/sammy

loader without urls

cking opened this issue · 2 comments

Please add a way to specify another resolver for sammy.js.

I am currently working on a project where templates are pre-rendered and data gets loaded over websockets.

For the data part, i am using the API directly to interact with it (less a problem), but I really would like to use the RenderContext. Problem is, like I said, it wants to load the templates as an ajax request to the server (which responds with error messages).

If I missed a part of the documentation, please point it to me, I am pretty new to sammy.

If you give me an example of what you want to do, I may be able to help you. Which part of the RenderContext do you want to use? Maybe the "send" function on the RenderContext helps you achieve what you want to do?

I am using socketstream, so all my templates are preloaded to html (and depending on the plugin preparsed)
Currently I am using it like this:

var app = Sammy("#main", function () {
    // presentation viewer
    this.get("#!/", function (ctx) {
        // set current question
        ctx.swap(ss.tmpl("view-name", {variable: "content"}));
   });
});

I like the ctx.render/ctx.partial functions (or similiar helper methods) but I dont know how to instantiate the RenderContext on my own.