Coder Social home page Coder Social logo

covuworie / navigation-single-page-applications Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 2.01 MB

Navigation for single page applications

License: MIT License

navigation xmlhttprequest html5 css3 typescript javascript frameworkless screencast html ajax asynchronous front-end-development navigation-interfaces css fragment-identifier dom documentobjectmodel single-page-applications routing caching

navigation-single-page-applications's Introduction

Navigation for Single Page Applications

The code in this repository is effectively forked from the navigation directory of this screencast repository. See the comments from the original author below. The only difference is here I decide to follow through using typescript instead. I also add a bonus snapshot at the end using the History API in conjunction with the page href to do the routing instead of using fragment identifiers.

Running the code

Each individual part is treated as a separate node project. To execute the code in the src directory of a snapshot do the following:

  1. Navigate to the typescript folder of a snapshot folder. The folder will contain a package.json file.
  2. Run npm install to install the development dependencies. There are only two: the typescript compiler and lite-server. Both will be installed locally when you execute this command.
  3. From a terminal either run npx tsc -w or node_modules/.bin/tsc -w to automatically watch for and compile changes in multiple typescript files in the project.
  4. From a separate terminal run npx lite-server or npm run dev to launch the development server in your browser.

Screencast

This screencast covers how to construct a single page application with a tab-like navigation user interface and routing. A solution is introduced that uses only Web Standards (HTML, JavaScript, CSS, The DOM).

Even though libraries like Bootstrap, Backbone, Angular, Knockout and Ember do most of the work for you when implementing this kind of system, this screencast does not use any libraries at all. This emphasizes the core technogies, and provides a foundation for understanding how those libraries work.

Curran Kelleher October 2014

Background

Single Page Application

Workflow Review

  • Editor / IDE
    • Needs to insert only spaces or only tabs
    • Mixed tabs and spaces causes editor-specific indentation errors
  • Git Command Line
    • Running on your machine in same directory as the editor
  • Local Server (e.g. python -m SimpleHTTPServer 8080)
    • This is far better than doing your development over an SSH connection
  • DOM Inspector (<p>Hello</p>)
  • JavaScript Console (console.log("Hello");)

Navigation Interfaces

  • Wordpress Blogs
  • Approaches
    • Separate HTML pages
      • e.g. PHP applications
      • Used to be standard practice
      • Replaced by the "Single Page Application"
    • Single Page Application
      • A single page with no reload
      • Dynamic behavior added using JavaScript
      • Content fetched as needed
      • Routing using a fragment identifier
        • Was the standard practice for a long time
        • Slowly being replaced by HTML5 History API
      • Routing using HTML5 History API
      • Caching

Examples

Check out the Example Viewer. Use left and right arrow keys to navigate.

Feel free to use and modify for your own presentations! MIT License.

By Curran Kelleher October 2014

navigation-single-page-applications's People

Contributors

covuworie 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.