0% found this document useful (0 votes)
62 views30 pages

JS For Templates

The document discusses using JavaScript templates on both the server and client. It notes that data like XML, JSON and BSON are easy to consume on the server but encoding can be slow. On the client, options for templating include XSLT or JavaScript frameworks, and there are many template engines available. The benefits mentioned are faster average response times when templating on the server before sending to the client, and having a single API for the whole project. Potential issues include slow internet speeds impacting template rendering, and errors stopping JavaScript which could impact the template. Solutions proposed are lazy loading or evaluating templates on the server before sending to the client. Twitter is provided as a famous example of a company using this approach.

Uploaded by

Alex T
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
62 views30 pages

JS For Templates

The document discusses using JavaScript templates on both the server and client. It notes that data like XML, JSON and BSON are easy to consume on the server but encoding can be slow. On the client, options for templating include XSLT or JavaScript frameworks, and there are many template engines available. The benefits mentioned are faster average response times when templating on the server before sending to the client, and having a single API for the whole project. Potential issues include slow internet speeds impacting template rendering, and errors stopping JavaScript which could impact the template. Solutions proposed are lazy loading or evaluating templates on the server before sending to the client. Twitter is provided as a famous example of a company using this approach.

Uploaded by

Alex T
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 30

JS forTemplates

write once - debug forever

Wednesday, 12 June 13

data: xml/json/bson

Wednesday, 12 June 13

data: xml/json/bson
server: easy to consume on server but slow encoding

Wednesday, 12 June 13

data: xml/json/bson
server: easy to consume on server - Rails magic parse on-y

Wednesday, 12 June 13

data: xml/json/bson
server: easy to consume on server - Rails magic parse on-y client: ???

Wednesday, 12 June 13

data: xml/json/bson
server: easy to consume on server - Rails magic parse on-y client: XSLT

Wednesday, 12 June 13

data: xml/json/bson
server: easy to consume on server - Rails magic parse on-y client: XSLT or *some js framework*

Wednesday, 12 June 13

data: xml/json/bson
server: easy to consume on server - Rails magic parse on-y client: XSLT or *some js framework* parse xml to json
Wednesday, 12 June 13

data: xml/json/bson
server: easy to consume on server or consume

Wednesday, 12 June 13

data: xml/json/bson
server: easy to consume on server or consume client: plenty of framework template engines

Wednesday, 12 June 13

data: xml/json/bson
same as json + very fast encoding

Wednesday, 12 June 13

Using same objects on server and client

Wednesday, 12 June 13

Common JSON

Wednesday, 12 June 13

Client Template

Wednesday, 12 June 13

Want more real examples?

Wednesday, 12 June 13

Example Data

Wednesday, 12 June 13

Getting template Data

Wednesday, 12 June 13

Perform templating

Wednesday, 12 June 13

Perform templating

Easy?

Wednesday, 12 June 13

Benets Avg. request response much much faster

Wednesday, 12 June 13

Benets Avg. request response much much MUCH faster One API for whole project

Wednesday, 12 June 13

Benets Avg. request response much much MUCH faster One API for whole project Bottle neck Users browser/computer speed

Wednesday, 12 June 13

Visible problem

Slow internet = crap templates

Wednesday, 12 June 13

Visible problem Slow internet = crap templates One error somewhere = stop js = crap templates

Wednesday, 12 June 13

Lazy load or eval on server

Loading and templating before show to


user

Wednesday, 12 June 13

Lazy load or eval on server

Loading and templating before show to


user

Eval on server with V8 or NodeJS

Wednesday, 12 June 13

Famous implementation

Twitter

Wednesday, 12 June 13

Famous implementation

Twitter
Project closed faster than you can imagine

Wednesday, 12 June 13

questions?

Wednesday, 12 June 13

No

Wednesday, 12 June 13

You might also like