Git Product home page Git Product logo

Comments (4)

winsmith avatar winsmith commented on July 18, 2024 1

Ooh I get it now, I think I had some misconceptions there. Thank you very much!

from leaf.

0xTim avatar 0xTim commented on July 18, 2024

You can do something like

request.view .render("template", context).map { view in
  let string = String(decoding: view.data.readableBytesView, as: UTF8.self)
}

from leaf.

winsmith avatar winsmith commented on July 18, 2024

Thanks! Okay, but I have to go through a view? Because I'm in a piece of code that is never rendered to a view because it gets run periodically. Is there a way to access the render method with just an Application? Played around with instantiating the LeafRenderer directly but got an EventLoopFuture<ByteBuffer> out of the render call that was never fulfilled.

(This might of course just be out of scope for Leaf, which is fine.)

from leaf.

0xTim avatar 0xTim commented on July 18, 2024

But you are going through a view because that's what the Leaf renderer is. So you need to render a view to generate the string for an email or whatever use case.

You should be able to use app.view.render... in the same way

from leaf.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.