Giter VIP home page Giter VIP logo

l8r.js's Introduction

l8r.js

A light-weight library that provides a type of "action queue" to keep track of application events triggered by user clicks that occur before the JS that will handle it has loaded.

At its simplest, here's how a click event is enqueued:

<a href="#" onclick="return l8r.nq( this )">Click me</a>

Enqueueing a high-level application event:

<a href="#" onclick="return l8r.nq(this, 'myapp.highlevel_event')">Click me</a>

l8r.js is inspired by work Alex Kessinger shared in a DailyJS post entitled Flickr's Asynchronous Script Loading Part 2. In this post, Alex takes a look at the following problem (from part 1):

If you are using a script loader, or even if you are just putting your scripts at the bottom of your DOM, you have a problem. In some cases your scripts will load after the user has clicked on something that requires a JavaScript function to handle the click. It's possible you have a pure HTML version, but if the user has JavaScript enabled then we want to use it, even if the JavaScript hasn’t loaded yet. There needs to be a way of handling events before all of the assets have finished loading.

While Alex's solution

l8r.js "holds on to" user click events that may occur on a document before the appropriate click handler callbacks are available to respond to the interactions.

Like Alex's allows you to queue up

l8r.js's People

Contributors

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