Giter Club home page Giter Club logo

train-scheduler's Introduction

Train-Scheduler

Overview


In this assignment, you'll create a train schedule application that incorporates Firebase to host arrival and departure data. Your app will retrieve and manipulate this information with Moment.js. This website will provide up-to-date information about various trains, namely their arrival times and how many minutes remain until they arrive at their station.

Requirements


  • Make sure that your app suits this basic spec:

    • When adding trains, administrators should be able to submit the following:

      • Train Name

      • Destination

      • First Train Time -- in military time

      • Frequency -- in minutes

    • Code this app to calculate when the next train will arrive; this should be relative to the current time.

    • Users from many different machines must be able to view same train times.

Files


Technologies Used


  • HTML
  • CSS Bootstrap
  • JavaScript to make the page dynamic
  • jQuery for Dom Manipulation
  • Firebase Database for data storage

Code Explanation


  • CSS Bootstrap was used to arrange the page into columns, tables and form.
  • A form was implemented to add the train details.
  • Firebase is used to store the data remotely so that users from many different machines must be able to view same train times.
    • Code and Syntax for push the data to firbase.
    var database = firebase.database();
    database.ref().push(data);
  • Event listener for submit button is utilized:
    • To get the inputted data and store in a variable.
    • To push the data into firesbase.
    • To clear the input field.
  • Function is called to display the data into the table from the firebase.
  • The data is retieved from the firebase is done in the function.
    • Code and Syntax for retrieving data.
    database.ref().on("child_added",function(snaphotChild){
        let trainName = snaphotChild.val().trainName;
        let destination = snaphotChild.val().destination;
        let startTime = snaphotChild.val().startTime;
        let frequency = snaphotChild.val().frequency;
    }
  • The display function is called in regular intervals using setInterval().
    • Code and Syntax for setInterval().
    setInterval(updateDisplay,60*1000);

NOTE

train-scheduler's People

Contributors

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