Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
A progress status plugin for Dancer2
Perl JavaScript
Branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
example
lib/Dancer2/Plugin
t
.travis.yml
Changes
README.md
dist.ini

README.md

Dancer2::Plugin::ProgressStatus

Build Status

A Dancer2 plugin that provides progress status helpers.

To install this module from source:

  dzil install

To use this module in your Dancer2 route:

  use Dancer2;
  use Dancer2::Plugin::ProgressStatus;

  get '/route' => sub {
    my $prog = start_progress_status('progress1');
    while($some_condition) {
        $prog++;
    }
  };

Then with some javascript on the front end, something like this:

      function displayProgress(data, done) {
          var prog = (data.count / data.total) * 100;
          $('#progress').html(Math.round(prog) + '%');
          if ( done ) {
              $('#progress').append("<br />Done!");
          }
      }
      function checkProgress() {
          $.getJSON('/_progressstatus/test', function(data) {
              if ( !data.in_progress ) {
                  displayProgress(data, true);
                  return;
              }
              displayProgress(data);
              setTimeout(checkProgress, 3000)
          })
      }

      checkProgress();
Something went wrong with that request. Please try again.