jssignals-rails 1.0.1 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +2 -1
- data/README.md +8 -6
- data/lib/jssignals/rails/version.rb +2 -2
- data/spec/jssignals/rails/version_spec.rb +2 -2
- data/vendor/assets/javascripts/signals.js +42 -28
- data/vendor/assets/javascripts/signals.min.js +5 -5
- metadata +17 -7
data/.gitignore
CHANGED
@@ -1 +1,2 @@
|
|
1
|
-
/Gemfile.lock
|
1
|
+
/Gemfile.lock
|
2
|
+
*.gem
|
data/README.md
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
# js-signals for Rails ![Build Status][travis_ci_build_status]
|
1
|
+
# js-signals for Rails [![Build Status][travis_ci_build_status]][travis_ci][![Dependency Status][gemnasium_dependency_status]][gemnasium]
|
2
2
|
|
3
|
-
Provides js-signals (0.
|
3
|
+
Provides js-signals (0.8.1) for use with Rails 3
|
4
4
|
|
5
|
-
[RubyGems][ruby_gems] | [Ruby Toolbox][ruby_toolbox] | [GitHub][github] | [Travis CI][travis_ci] | [RubyDoc][ruby_doc]
|
5
|
+
[RubyGems][ruby_gems] | [Ruby Toolbox][ruby_toolbox] | [GitHub][github] | [Travis CI][travis_ci] | [Gemnasium][gemnasium] | [RubyDoc][ruby_doc]
|
6
6
|
|
7
7
|
## Installation
|
8
8
|
### Rails 3.1+
|
@@ -39,11 +39,13 @@ js-signals is now installed. Woop!
|
|
39
39
|
##js-signals Resources
|
40
40
|
[Project Page][jssignals_project_page] | [GitHub][jssignals_github]
|
41
41
|
|
42
|
-
[github]: http://github.com/philostler/jssignals-rails
|
43
|
-
[ruby_doc]: http://rubydoc.info/github/philostler/jssignals-rails/master/frames
|
44
42
|
[ruby_gems]: http://rubygems.org/gems/jssignals-rails
|
43
|
+
[ruby_toolbox]: http://www.ruby-toolbox.com/projects/jssignals-rails
|
44
|
+
[github]: http://github.com/philostler/jssignals-rails
|
45
45
|
[travis_ci]: http://travis-ci.org/philostler/jssignals-rails
|
46
46
|
[travis_ci_build_status]: https://secure.travis-ci.org/philostler/jssignals-rails.png
|
47
|
-
[
|
47
|
+
[gemnasium]: https://gemnasium.com/philostler/jssignals-rails
|
48
|
+
[gemnasium_dependency_status]: https://gemnasium.com/philostler/jssignals-rails.png
|
49
|
+
[ruby_doc]: http://rubydoc.info/github/philostler/jssignals-rails/master/frames
|
48
50
|
[jssignals_project_page]: http://millermedeiros.github.com/js-signals
|
49
51
|
[jssignals_github]: http://github.com/millermedeiros/js-signals
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
3
|
describe Jssignals::Rails do
|
4
|
-
it { Jssignals::Rails::VERSION.should == "1.
|
5
|
-
it { Jssignals::Rails::JSSIGNALS_VERSION.should == "0.
|
4
|
+
it { Jssignals::Rails::VERSION.should == "1.1.1" }
|
5
|
+
it { Jssignals::Rails::JSSIGNALS_VERSION.should == "0.8.1" }
|
6
6
|
end
|
@@ -1,29 +1,15 @@
|
|
1
1
|
/*jslint onevar:true, undef:true, newcap:true, regexp:true, bitwise:true, maxerr:50, indent:4, white:false, nomen:false, plusplus:false */
|
2
|
-
/*global define:false, require:false, exports:false, module:false*/
|
2
|
+
/*global define:false, require:false, exports:false, module:false, signals:false */
|
3
3
|
|
4
4
|
/** @license
|
5
5
|
* JS Signals <http://millermedeiros.github.com/js-signals/>
|
6
6
|
* Released under the MIT license
|
7
7
|
* Author: Miller Medeiros
|
8
|
-
* Version: 0.
|
8
|
+
* Version: 0.8.1 - Build: 266 (2012/07/31 03:33 PM)
|
9
9
|
*/
|
10
10
|
|
11
11
|
(function(global){
|
12
12
|
|
13
|
-
/**
|
14
|
-
* @namespace Signals Namespace - Custom event/messaging system based on AS3 Signals
|
15
|
-
* @name signals
|
16
|
-
*/
|
17
|
-
var signals = /** @lends signals */{
|
18
|
-
/**
|
19
|
-
* Signals Version Number
|
20
|
-
* @type String
|
21
|
-
* @const
|
22
|
-
*/
|
23
|
-
VERSION : '0.7.4'
|
24
|
-
};
|
25
|
-
|
26
|
-
|
27
13
|
// SignalBinding -------------------------------------------------
|
28
14
|
//================================================================
|
29
15
|
|
@@ -34,8 +20,8 @@
|
|
34
20
|
* @author Miller Medeiros
|
35
21
|
* @constructor
|
36
22
|
* @internal
|
37
|
-
* @name
|
38
|
-
* @param {
|
23
|
+
* @name SignalBinding
|
24
|
+
* @param {Signal} signal Reference to Signal object that listener is currently bound to.
|
39
25
|
* @param {Function} listener Handler function bound to the signal.
|
40
26
|
* @param {boolean} isOnce If binding should be executed just once.
|
41
27
|
* @param {Object} [listenerContext] Context on which listener will be executed (object that should represent the `this` variable inside listener function).
|
@@ -59,7 +45,7 @@
|
|
59
45
|
|
60
46
|
/**
|
61
47
|
* Context on which listener will be executed (object that should represent the `this` variable inside listener function).
|
62
|
-
* @memberOf
|
48
|
+
* @memberOf SignalBinding.prototype
|
63
49
|
* @name context
|
64
50
|
* @type Object|undefined|null
|
65
51
|
*/
|
@@ -67,7 +53,7 @@
|
|
67
53
|
|
68
54
|
/**
|
69
55
|
* Reference to Signal object that listener is currently bound to.
|
70
|
-
* @type
|
56
|
+
* @type Signal
|
71
57
|
* @private
|
72
58
|
*/
|
73
59
|
this._signal = signal;
|
@@ -80,7 +66,7 @@
|
|
80
66
|
this._priority = priority || 0;
|
81
67
|
}
|
82
68
|
|
83
|
-
SignalBinding.prototype =
|
69
|
+
SignalBinding.prototype = {
|
84
70
|
|
85
71
|
/**
|
86
72
|
* If binding is active and should be executed.
|
@@ -162,7 +148,7 @@
|
|
162
148
|
};
|
163
149
|
|
164
150
|
|
165
|
-
/*global
|
151
|
+
/*global SignalBinding:false*/
|
166
152
|
|
167
153
|
// Signal --------------------------------------------------------
|
168
154
|
//================================================================
|
@@ -176,19 +162,27 @@
|
|
176
162
|
/**
|
177
163
|
* Custom event broadcaster
|
178
164
|
* <br />- inspired by Robert Penner's AS3 Signals.
|
165
|
+
* @name Signal
|
179
166
|
* @author Miller Medeiros
|
180
167
|
* @constructor
|
181
168
|
*/
|
182
|
-
|
169
|
+
function Signal() {
|
183
170
|
/**
|
184
171
|
* @type Array.<SignalBinding>
|
185
172
|
* @private
|
186
173
|
*/
|
187
174
|
this._bindings = [];
|
188
175
|
this._prevParams = null;
|
189
|
-
}
|
176
|
+
}
|
190
177
|
|
191
|
-
|
178
|
+
Signal.prototype = {
|
179
|
+
|
180
|
+
/**
|
181
|
+
* Signals Version Number
|
182
|
+
* @type String
|
183
|
+
* @const
|
184
|
+
*/
|
185
|
+
VERSION : '0.8.1',
|
192
186
|
|
193
187
|
/**
|
194
188
|
* If Signal should keep record of previously dispatched parameters and
|
@@ -341,7 +335,7 @@
|
|
341
335
|
/**
|
342
336
|
* Stop propagation of the event, blocking the dispatch to next listeners on the queue.
|
343
337
|
* <p><strong>IMPORTANT:</strong> should be called only during signal dispatch, calling it before/after dispatch won't affect signal broadcast.</p>
|
344
|
-
* @see
|
338
|
+
* @see Signal.prototype.disable
|
345
339
|
*/
|
346
340
|
halt : function () {
|
347
341
|
this._shouldPropagate = false;
|
@@ -379,7 +373,7 @@
|
|
379
373
|
|
380
374
|
/**
|
381
375
|
* Forget memorized arguments.
|
382
|
-
* @see
|
376
|
+
* @see Signal.memorize
|
383
377
|
*/
|
384
378
|
forget : function(){
|
385
379
|
this._prevParams = null;
|
@@ -405,13 +399,33 @@
|
|
405
399
|
};
|
406
400
|
|
407
401
|
|
402
|
+
// Namespace -----------------------------------------------------
|
403
|
+
//================================================================
|
404
|
+
|
405
|
+
/**
|
406
|
+
* Signals namespace
|
407
|
+
* @namespace
|
408
|
+
* @name signals
|
409
|
+
*/
|
410
|
+
var signals = Signal;
|
411
|
+
|
412
|
+
/**
|
413
|
+
* Custom event broadcaster
|
414
|
+
* @see Signal
|
415
|
+
*/
|
416
|
+
// alias for backwards compatibility (see #gh-44)
|
417
|
+
signals.Signal = Signal;
|
418
|
+
|
419
|
+
|
420
|
+
|
408
421
|
//exports to multiple environments
|
409
422
|
if(typeof define === 'function' && define.amd){ //AMD
|
410
|
-
define(signals);
|
423
|
+
define(function () { return signals; });
|
411
424
|
} else if (typeof module !== 'undefined' && module.exports){ //node
|
412
425
|
module.exports = signals;
|
413
426
|
} else { //browser
|
414
427
|
//use string because of Google closure compiler ADVANCED_MODE
|
428
|
+
/*jslint sub:true */
|
415
429
|
global['signals'] = signals;
|
416
430
|
}
|
417
431
|
|
@@ -3,11 +3,11 @@
|
|
3
3
|
JS Signals <http://millermedeiros.github.com/js-signals/>
|
4
4
|
Released under the MIT license
|
5
5
|
Author: Miller Medeiros
|
6
|
-
Version: 0.
|
6
|
+
Version: 0.8.1 - Build: 266 (2012/07/31 03:33 PM)
|
7
7
|
*/
|
8
|
-
(function(h){function g(a,b,c,d
|
9
|
-
this._signal.remove(this._listener,this.context):null},isBound:function(){return!!this._signal&&!!this._listener},getListener:function(){return this._listener},_destroy:function(){delete this._signal;delete this._listener;delete this.context},isOnce:function(){return this._isOnce},toString:function(){return"[SignalBinding isOnce:"+this._isOnce+", isBound:"+this.isBound()+", active:"+this.active+"]"}};
|
10
|
-
active:!0,_registerListener:function(a,b,c,
|
8
|
+
(function(h){function g(a,b,c,e,d){this._listener=b;this._isOnce=c;this.context=e;this._signal=a;this._priority=d||0}function f(a,b){if(typeof a!=="function")throw Error("listener is a required param of {fn}() and should be a Function.".replace("{fn}",b));}function d(){this._bindings=[];this._prevParams=null}g.prototype={active:!0,params:null,execute:function(a){var b;this.active&&this._listener&&(a=this.params?this.params.concat(a):a,b=this._listener.apply(this.context,a),this._isOnce&&this.detach());
|
9
|
+
return b},detach:function(){return this.isBound()?this._signal.remove(this._listener,this.context):null},isBound:function(){return!!this._signal&&!!this._listener},getListener:function(){return this._listener},_destroy:function(){delete this._signal;delete this._listener;delete this.context},isOnce:function(){return this._isOnce},toString:function(){return"[SignalBinding isOnce:"+this._isOnce+", isBound:"+this.isBound()+", active:"+this.active+"]"}};d.prototype={VERSION:"0.8.1",memorize:!1,_shouldPropagate:!0,
|
10
|
+
active:!0,_registerListener:function(a,b,c,e){var d=this._indexOfListener(a,c);if(d!==-1){if(a=this._bindings[d],a.isOnce()!==b)throw Error("You cannot add"+(b?"":"Once")+"() then add"+(!b?"":"Once")+"() the same listener without removing the relationship first.");}else a=new g(this,a,b,c,e),this._addBinding(a);this.memorize&&this._prevParams&&a.execute(this._prevParams);return a},_addBinding:function(a){var b=this._bindings.length;do--b;while(this._bindings[b]&&a._priority<=this._bindings[b]._priority);
|
11
11
|
this._bindings.splice(b+1,0,a)},_indexOfListener:function(a,b){for(var c=this._bindings.length,d;c--;)if(d=this._bindings[c],d._listener===a&&d.context===b)return c;return-1},has:function(a,b){return this._indexOfListener(a,b)!==-1},add:function(a,b,c){f(a,"add");return this._registerListener(a,!1,b,c)},addOnce:function(a,b,c){f(a,"addOnce");return this._registerListener(a,!0,b,c)},remove:function(a,b){f(a,"remove");var c=this._indexOfListener(a,b);c!==-1&&(this._bindings[c]._destroy(),this._bindings.splice(c,
|
12
12
|
1));return a},removeAll:function(){for(var a=this._bindings.length;a--;)this._bindings[a]._destroy();this._bindings.length=0},getNumListeners:function(){return this._bindings.length},halt:function(){this._shouldPropagate=!1},dispatch:function(a){if(this.active){var b=Array.prototype.slice.call(arguments),c=this._bindings.length,d;if(this.memorize)this._prevParams=b;if(c){d=this._bindings.slice();this._shouldPropagate=!0;do c--;while(d[c]&&this._shouldPropagate&&d[c].execute(b)!==!1)}}},forget:function(){this._prevParams=
|
13
|
-
null},dispose:function(){this.removeAll();delete this._bindings;delete this._prevParams},toString:function(){return"[Signal active:"+this.active+" numListeners:"+this.getNumListeners()+"]"}};typeof define==="function"&&define.amd?define(
|
13
|
+
null},dispose:function(){this.removeAll();delete this._bindings;delete this._prevParams},toString:function(){return"[Signal active:"+this.active+" numListeners:"+this.getNumListeners()+"]"}};d.Signal=d;typeof define==="function"&&define.amd?define(function(){return d}):typeof module!=="undefined"&&module.exports?module.exports=d:h.signals=d})(this);
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jssignals-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-09-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: railties
|
16
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,15 @@ dependencies:
|
|
21
21
|
version: '3.0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '3.0'
|
25
30
|
- !ruby/object:Gem::Dependency
|
26
31
|
name: rspec
|
27
|
-
requirement:
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
28
33
|
none: false
|
29
34
|
requirements:
|
30
35
|
- - ~>
|
@@ -32,7 +37,12 @@ dependencies:
|
|
32
37
|
version: '2.0'
|
33
38
|
type: :development
|
34
39
|
prerelease: false
|
35
|
-
version_requirements:
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '2.0'
|
36
46
|
description: Provides js-signals for use with Rails 3
|
37
47
|
email: philostler@gmail.com
|
38
48
|
executables: []
|
@@ -76,7 +86,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
76
86
|
version: '0'
|
77
87
|
requirements: []
|
78
88
|
rubyforge_project:
|
79
|
-
rubygems_version: 1.8.
|
89
|
+
rubygems_version: 1.8.24
|
80
90
|
signing_key:
|
81
91
|
specification_version: 3
|
82
92
|
summary: js-signals for Rails
|