GithubHelp home page GithubHelp logo

federicobucchi / reanimator Goto Github PK

View Code? Open in Web Editor NEW

This project forked from waterfallengineering/reanimator

0.0 2.0 0.0 1.02 MB

Capture and replay execution traces of client-side web applications

reanimator's Introduction

Reanimator

Capture and replay JavaScript applications

Reanimator captures non-deterministic input to a JavaScript application in a log that can replayed at a later date. It was originally designed for recording web application crashes in the wild for later debugging, but it may be useful for other purposes, such as usability testing and tutorials.

Reanimator consists of a core, which is responsible for capture setup and driving the replay, and one or more plugins, which are responsible for capturing and replaying non-deterministic input.

Reanimator ships with plugins for capturing and replaying random numbers, dates, and timer interrupts. In addition, Reanimator provides plugins for capturing and replaying callback invocations in the following frameworks:

  • jQuery 1.8.3

Reanimator was inspired by Mugshot by James Mickens, Jeremy Elson, and Jon Howell.

Demos

Tile game

API

Reanimator.capture

Capture non-deterministic input

Call this method to begin logging non-deterministic input to your JavaScript application. To capture a useful log, you must call Reanimator.capture before such input occurs, but after libraries like jQuery have been loaded.

The log is reset whenever this method is called.

Reanimator.replay

Replay a log of non-deterministic input

Arguments

  • log - object - the log to replay, in the format emitted by Reanimator.flush
  • config - object - configuration object
    • config.delay - string | integer - how long Reanimator should wait before replaying the next event in the log

      For a fixed delay, specify the number of ms between steps (the default is 0). If the string 'realtime' is specified, Reanimator will make a good faith effort to replay the events with the actual delays recorded in the log.

Reanimator.flush

Return a copy of the current log

Returns a copy of the current log as an object with the following properties:

  • dates - [ number ] - captured dates, specified in ms since the epoch

  • random - [ number ] - captured random numbers generated by Math.random

  • events - [ object ] - captured callback invocations

    Each element is an object with the following properties:

    • type - string - the type of the recorded callback
    • time - number - the time the callback was fired (ms since the epoch)
    • details - any - any additional details necessary to replay the callback

Reanimator.cleanUp

Stop capturing or replaying and restore native methods and objects

This method does not clear the most recent log.

Reanimator.plug

Install a plugin to capture and replay some non-deterministic input

Arguments

  • type - string - a unique string corresponding to the type property of any events the plugin will log
  • plugin - object - the plugin to install

A plugin is an object that implements the following methods:

  • init: initialize the plugin

    Called once, by plug

    Arguments

    • native - object - an object to store a reference to any native methods or objects the plugin interposes on
  • capture: prepare to capture the input the plugin is responsible for

    Called by Reanimator.capture

  • cleanUp - restore any native methods or objects the plugin interposed on

  • beforeReplay - prepare to replay

    Optional; called by Reanimator.replay immediately before the first event is replayed

    Arguments

    • log - object - the log to be replayed
    • config - object - the replay configuration
  • replay - replay a captured event

    Required if the plugin logs to events, optional otherwise

    Arguments

    • event - object - the event to replay, in the format specified above in Reanimator.flush

License

Reanimator is made available under the MIT License.

Acknowledgements and Attribution

Thanks to James Mickens, Jeremy Elson, and Jon Howell for their excellent work on Mugshot, which inspired Reanimator.

The image demos/tile-game/img/reanimator.jpg is the work [Re-Animator] (http://fav.me/d24n0v9) and is copyright (c) 2009 ~cool-slayer and made available under an Attribution-Noncommercial-No Derivative Works 3.0 License.

reanimator's People

Contributors

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