Git Product home page Git Product logo

freshmaker's Introduction

Freshmaker

On July 26, 2008 Stoyan Stefanov published his seminal blog post location=location which listed 535 ways to refresh a page using JavaScript. At the time I was just learning how to JavaScript (by hacking about with the at-the-time flagship Prototype JS) and legitimately used this page as a resource when I needed to learn how to trigger a full-page refresh.

In a fit of whiskey-fueled madness I thought (as any sane person would) "Why not bundle all 535 of these into one object and build a script that will pick one at random when a refresh is needed?"

And here we are. To be clear: this is the worst thing anyone's ever made. Nobody in their right mind should use this in their project.

That said, if you really really really want to, here's how!

howto.txt

First off, you need to include freshmaker.js into your page (maybe someday I'll put this up as a bower package or something equally time-wasting). Any time you need to trigger a page refresh just call _fm(); and Bob's your uncle.

Freshmaker has no dependencies other than possibly your own lack of self-respect and a stiff drink. Well, ok it's not going to work in browsers that don't do ECMAScript 5 because it makes use of Object.keys but if you're still coding for IE 8, I mean, you've got bigger issues to deal with than not being able to use this stupid thing.

options (because why not)

If you're curious to know which one of the 535 options is being used on any given refresh, just pass a number as an argument to the function. It will delay for that many seconds and log the function being used to the console! I know! _fm(5); will wait for 5 seconds before firing and console.log() the refresh method being used. Any argument passed that's not a number is ignored.

freshmaker's People

Contributors

humantorch avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

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