peek-performance_bar
peek-performance_bar copied to clipboard
support custom events to trigger update
This PR provides a way to use peek-performance_bar with standard Ajax requests that are not carried out via Pjax or Turbolinks, simply by supporting custom peek:start
and peek:end
events.
For example, you could do something like this to update the performance bar for all Ajax requests:
$(document).on('ajax:send', function() { $(this).trigger('peek:start') })
$(document).on('ajax:complete', function() { $(this).trigger('peek:end') })
:cool: could you update the documentation showing how to use this?
@dewski I've updated the README. Let me know if it looks good to you.
@dewski ping. Any reason not to merge this in?
@barunio sorry for the delayed response. There seems to be a merge conflict and I can't merge it until that is resolved. The docs look good to me!
Another small note after reviewing the code again is it would be helpful to change the event prefixes from peek:
to peek:performance-bar
that way it's only scoped for this view.