From efbeb4bfcb07784537f8462fb3211dccbdbbf88f Mon Sep 17 00:00:00 2001 From: kbparagua Date: Wed, 2 Mar 2016 12:01:19 +0800 Subject: [PATCH] Do not start Paloma's engine if current request and last request are the same --- paloma.gemspec | 1 + test_app/app/assets/javascripts/application.js | 4 ++-- vendor/assets/javascripts/paloma/engine.js | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/paloma.gemspec b/paloma.gemspec index 811800e..bea76c0 100644 --- a/paloma.gemspec +++ b/paloma.gemspec @@ -9,6 +9,7 @@ Gem::Specification.new do |s| s.homepage = 'https://github.com/kbparagua/paloma' s.license = 'MIT' + s.add_development_dependency 'jquery-rails' s.add_development_dependency 'rails', ['~> 3.2.0'] s.add_development_dependency 'rake', ['>= 0'] s.add_development_dependency 'rspec', ['>= 0'] diff --git a/test_app/app/assets/javascripts/application.js b/test_app/app/assets/javascripts/application.js index 1aa01aa..5623d64 100644 --- a/test_app/app/assets/javascripts/application.js +++ b/test_app/app/assets/javascripts/application.js @@ -11,9 +11,9 @@ // GO AFTER THE REQUIRES BELOW. // //= require jquery -//= require jquery.turbolinks +//=# require jquery.turbolinks //= require jquery_ujs -//= require turbolinks +//=# require turbolinks //= require paloma //= require_tree . diff --git a/vendor/assets/javascripts/paloma/engine.js b/vendor/assets/javascripts/paloma/engine.js index d6f1acb..0e8ff9e 100644 --- a/vendor/assets/javascripts/paloma/engine.js +++ b/vendor/assets/javascripts/paloma/engine.js @@ -7,6 +7,7 @@ Engine.prototype.start = function(){ if ( !this._request ) return; + if ( this._request.id == this.lastRequest().id ) return; this._lastRequest = this._request;