honkster-jelly 0.8.11 → 0.8.12

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: 8
3
- :patch: 11
3
+ :patch: 12
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.8.11
5
+ * version 0.8.12
6
6
  *
7
7
  * Copyright (c) 2009 Pivotal Labs
8
8
  * Licensed under the MIT license.
@@ -62,41 +62,46 @@ $.extend(Jelly, {
62
62
  }
63
63
  },
64
64
 
65
- notify: function(callbacks) {
65
+ notify: function(instructions) {
66
66
  if (this == Jelly) {
67
67
  return Jelly.Observers.notify.apply(this.observers, arguments);
68
68
  }
69
- if (!$.isArray(callbacks)) {
70
- callbacks = [callbacks];
69
+ if (!$.isArray(instructions)) {
70
+ instructions = [instructions];
71
71
  }
72
72
 
73
73
  var pristineObservers = this.slice(0);
74
74
  var observers;
75
- for (var i = 0; i < callbacks.length; i++) {
76
- var callback = callbacks[i];
75
+ for (var i = 0; i < instructions.length; i++) {
76
+ var instruction = instructions[i];
77
77
 
78
78
  // Deprecate 'on' in favor of making each page action a Component.
79
- if (callback.on) {
80
- observers = [eval(callback.on)];
79
+ if (instruction.on) {
80
+ observers = [eval(instruction.on)];
81
81
  } else {
82
82
  observers = pristineObservers;
83
83
  }
84
84
 
85
- if (callback.method) {
85
+ if (instruction.method) {
86
86
  for (var j = 0; j < observers.length; j++) {
87
87
  var observer = observers[j];
88
- if (observer[callback.method]) {
89
- if (observer.detach && observer.detach()) {
90
- Jelly.Observers.garbageCollectObserver.call(this, observer);
91
- } else {
92
- observer[callback.method].apply(observer, callback.arguments);
93
- }
94
- }
88
+ Jelly.Observers.notifyObserver.call(this, observer, instruction.method, instruction.arguments);
89
+ Jelly.Observers.notifyObserver.call(this, observer, 'on_notify', [instruction]);
95
90
  }
96
91
  }
97
92
 
98
- if (callback.attach) {
99
- Jelly.Observers.attach.apply(this, callback.attach);
93
+ if (instruction.attach) {
94
+ Jelly.Observers.attach.apply(this, instruction.attach);
95
+ }
96
+ }
97
+ },
98
+
99
+ notifyObserver: function(observer, method, arguments) {
100
+ if (observer[method]) {
101
+ if (observer.detach && observer.detach()) {
102
+ Jelly.Observers.garbageCollectObserver.call(this, observer);
103
+ } else {
104
+ observer[method].apply(observer, arguments);
100
105
  }
101
106
  }
102
107
  },
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.8.11"
8
+ s.version = "0.8.12"
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.8.11
4
+ version: 0.8.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pivotal Labs, Inc