Sign Up Now!

Sign up and get personalized intelligence briefing delivered daily.

Sign Up

Articles related to "html"

Converting an Electron view content to PDF

  • My first approach for this problem is to retrieve the dynamic HTML with styles and send those to the main.js file which is written in Node js using an Ajax request.
  • Now, let's add some code to the bottom of the file to convert the web content into PDF.
  • After writing the file, we now send an event named wrote-pdf which will be handled in the renderer.js.
  • Now when the button is clicked, we send an event print-to-pdf to the main.js which will handle the conversion process.
  • After conversion, the main.js will now send an event wrote-pdf which is used to print the location of the pdf file in the Electron app.
  • After clicking the button the location will be written into the application view and a pdf file will be created.

save | comments | report | share on

How JavaScript works: the rendering engine and tips to optimize its performance

  • In the process of identifying and describing the core elements, we also share some rules of thumb we use when building SessionStack, a JavaScript application that needs to be robust and highly-performant to help users see and reproduce their web app defects real-time.
  • In this post, we’re going to focus on the rendering engine, since it’s handling the parsing and the visualization of the HTML and the CSS, which is something that most JavaScript apps are constantly interacting with.
  • The first step of the rendering engine is parsing the HTML document and converting the parsed elements to actual DOM nodes in a DOM tree.
  • Layout is a recursive process — it begins at the root renderer, which corresponds to the <html> element of the HTML document.

save | comments | report | share on

A Comprehensive Guide to React.js in 2018

  • What makes React so convenient for building user interfaces is that data is either received from a component’s parent component, or it’s contained in the component itself.
  • The “HTML” that you’re writing in the render method isn’t actually HTML but it’s what React is calling “JSX”.
  • Going back to the Twitter example from earlier, the UserInfo component (highlighted in pink above) is responsible for managing the state (or data) of the users information.
  • So in the next code sample, we’re going to now have an input box that whenever someone types into it, it will automatically update our state and change the username.
  • A user types into the input box → handleChange is invoked → the state of our component is set to a new value → React re-renders the virtual DOM → React Diffs the change → Real DOM is updated.

save | comments | report | share on

Repl.It 1.0: IDE that Grows from Playgrounds to Fullstack Apps

  • If you want to use files, write to files, split your code into modules, etc., you just do that and behinds the scenes the environment will switch to one where you're interacting with the filesystem.
  • You use it to listen on a port, any port you'd like; we'll detect that, host your server/repl on your subdomain (forever!) and that's it you're developing/deploying an application.
  • We also know that not all applications will grow incrementally so in typical one-click-start fashion we've pre-setup a Django, Rails, Express, and Sinatra apps.
  • serverless apps are unique in that they're stateful and that the same repl, same protocol, same everything, that you use in development is deployed and running in production.
  • After getting user-interest @pyelias is starting to explore building a full stack application using Django.

save | comments | report | share on

'Server Rendering with React and React Router'

  • Now that we get the big picture, let's work on creating the foundation for what will become a server rendered React Router app.
  • What .hydrate is going to do is it tells React that you've already created the markup on the server and instead of recreating it on the client, it should preserve it and just attach any needed event handlers to the existing server rendered markup.
  • That "Hello World" was initially rendered on the server, then when it got to the client and the bundle.js file loaded, React took over.
  • You need to make sure that the component is rendered with the same data (or props) on both the client and server.
  • The idea is when a GET request is made to our server, instead of calling renderToString immediately, we fetch the popular repositories first and then call it after giving our React app the data.

save | comments | report | share on

If you could start over from scratch, how would CSS work?

  • And I'm talking about web styling in general, doesn't have to be "cascading stylesheets" or anything like what we currently have.
  • The only parts I would change are: - Make CSS cascade more and support nesting style blocks (like S[A/C]SS) - Allow HTML Imports so we can write CSS in a <style> and not forced to use JS - Take a another look at existing properties and reevaluate them.
  • I’m curious that you don’t know what I mean with my previous remark, since unpredictability is pretty much a staple of CSS, so much so that it’s spawned jokes like
  • Houdini has some good promise to make CSS a lot better and Custom Elements (with more browser support) might make HTML more expressive.
  • While I enjoy flexbox and especially grid, but I recently started using Elm and find the approach taken by the style-elements package very insightful.

save | comments | report | share on

Writing a Microservice in Rust

  • With microservice, I mean an application that speaks HTTP, accepts requests, speaks to a database, returns a response (possibly serving HTML), packaged up in a Docker container and ready to be dropped somewhere in the cloud.
  • Since we’re building a chat application, the two kinds of requests we’ll want to handle are POST requests, with form data containing the user’s name and the message, and GET requests with optional before and after parameters to filter by time.
  • We’ll accept POST requests to our service’s root path ("/") and expect them to contain a username and message field in their form data.
  • In such a case, parse_query will return an error message, which we can forward to the make_error_response function we wrote earlier.
  • If the messages option contains a value, we can pass the messages on to render_page, which will return an HTML page that forms the body of our response, showing the messages in a simple HTML list.

save | comments | report | share on