Giter Club home page Giter Club logo

js-challenge's Introduction

BuildingBlok JS Programming Challenge

In order to be considered for a JavaScript position, you must complete the following steps.

Task

  • Fork this repository
  • Open index.html

You will find a purposefully minimal amount of JS in the page. The problem is to construct an offline caching object that will attempt to save records, retry failures, or queue objects to be saved if the app is in an offline state.

To keep the problem simple no backend is necessary. Your object will just call the global saveRecord(record) method and it will return true if the object was saved and false otherwise.

Steps

  • Add at least 2 forms with various fields to the page to simulate different kinds of records that can be saved.
  • Saving the form will queue the form results into your cacher
  • If the app is online (based on ourapp.offline) the cacher will immediately try to save the record
  • Even when online there is a chance saveRecord will return false to simulate a network failure. When this happens the cacher should wait at least 5 seconds before trying to save the request again.
  • If the app is offline the cacher will simply queue the record.
  • When the app's offline state changes from false to true any saved records should be flushed.
  • Write some tests to exercise your cacher using the test runner of your choosing
  • Visually format and display the results (see ourapp.results)

Possibilities (bonus points)

  • Introduce a framework to manage the forms and better structure your logic
  • Allow a configurable maxRetries setting so that failed attempts don't continue into eternity
  • Auto detect the app has gone offline if x amount of records fail to save in a row
  • Render the state of your cacher's queues

Once Complete

Send your results in a pull request. We will review your code and get back to you.

js-challenge's People

Contributors

georgedrummond avatar gjastrab avatar

Watchers

 avatar James Cloos 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.