Code Monkey home page Code Monkey logo

alice's Introduction

alice

A demonstration of how to replace gwtp-crawler with gwt-pushstate

This project uses a simple pattern that will speed up your gwtp app, improve SEO and make it more accessable.

Live site: http://4.pushstateslash.appspot.com

This is a website that displays chapters of alice in wonderland.

It has a single RouteTokenPlace: /alice/{chapterNumber}

Here's what happens when you visit /alice/3

On the server:
  • The server translates the place request and sees that the user wants chapter 3.

  • It then calls the FetchChapterHandler and stores the result in a javascript map var PREFETCH_DISPATCH (Check the pages html source to see this.)

  • Then it takes the result of FetchChapterHandler and uses it to create a very simple html version of the chapter which it includes in the html source noscript tag.

On the client:
  • The HomePagePresenter is called as normal and also sees that the user wants chapter 3.

  • It asks the dispatcher for chapter 3 and the dispatcher seeing that the result is in the javascript PREFETCH_DISPATCH map returns it immediately.

  • The HomePage presenter displays the chapter as well as a next and previous button.

  • If you click next or previous the page won't reload but instead the new chapter will be fetched from the server and displayed.

The Advantages

  • This pattern makes your site display faster because the dispatcher doesn't have to contact the server for the first call.

  • Your page has content for non-javascript agents, so you've improved SEO and accessability.

  • Plus because the noScript content is very similar to the PREFETCH_DISPATCH content gzip will make the noScript content virtually costless.

alice's People

Contributors

rdwallis avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

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.