honkster-jelly 0.7.2 → 0.7.3

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :minor: 7
3
- :patch: 2
3
+ :patch: 3
4
4
  :major: 0
@@ -2,7 +2,7 @@
2
2
  * Jelly. a sweet unobtrusive javascript framework
3
3
  * for jQuery and Rails
4
4
  *
5
- * version 0.7.2
5
+ * version 0.7.3
6
6
  *
7
7
  * Copyright (c) 2009 Pivotal Labs
8
8
  * Licensed under the MIT license.
@@ -66,11 +66,28 @@ Jelly.notifyObservers = function(params, observers) {
66
66
  for (var i = 0; i < observers.length; i++) {
67
67
  var observer = observers[i];
68
68
  if (observer[params.method]) {
69
- observer[params.method].apply(observer, params.arguments);
69
+ if (observer.detach && observer.detach()) {
70
+ this.garbageCollectObserver(observer);
71
+ } else {
72
+ observer[params.method].apply(observer, params.arguments);
73
+ }
70
74
  }
71
75
  }
72
76
  };
73
77
 
78
+ Jelly.garbageCollectObserver = function(observer) {
79
+ var index = Jelly.observers.indexOf(observer);
80
+ if (index > -1) {
81
+ this.arrayRemove(Jelly.observers, index, index + 1);
82
+ }
83
+ };
84
+
85
+ Jelly.arrayRemove = function(array, from, to) {
86
+ var rest = array.slice((to || from) + 1 || array.length);
87
+ array.length = from < 0 ? array.length + from : from;
88
+ return array.push.apply(array, rest);
89
+ };
90
+
74
91
  Jelly.Components = {
75
92
  init: function() {
76
93
  for (var i = 0; i < Jelly.components.length; i++) {
data/jelly.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{jelly}
8
- s.version = "0.7.2"
8
+ s.version = "0.7.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Pivotal Labs, Inc"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: honkster-jelly
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.2
4
+ version: 0.7.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pivotal Labs, Inc