transistor 0.1.9 → 0.1.10
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.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/build/min/transistor-backbone.js +1 -1
- data/build/src/transistor-backbone.js +3 -2
- data/js/transistor/backbone-collection.js +3 -2
- data/lib/assets/javascripts/transistor-backbone.js +3 -2
- data/spec/javascripts/TransistorBackboneCollectionSpec.js +6 -1
- data/spec/javascripts/TransistorRadioSpec.js +4 -4
- data/transistor.gemspec +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 285f53c281cb9bbd5807c07c975c3af2d522a4c0
|
4
|
+
data.tar.gz: 5ee6e658e25e58a75223c85f5d83878aa6af4fe2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 93bb735044b2cf4a1a7a0ff4b71e67e6c6fada8ddf6805f67ef4b738a88055a0b2823ee79fa7628c4caf0dbb720df25043edc6b900ee829419f78599aaa67c6b
|
7
|
+
data.tar.gz: 9ca251dcb8b271695de6cef5ab718e8e6af6ef99ab09f912f33f9198e8260d9520c5b6e140f6d33f83d334cfae7765838fb51dbd79fe6d256efa4fec0e30f33b
|
data/Gemfile.lock
CHANGED
@@ -1 +1 @@
|
|
1
|
-
if(window.Transistor===undefined){window.Transistor={}}(function(
|
1
|
+
if(window.Transistor===undefined){window.Transistor={}}(function(j){var q=(function(){return function(h){var k,n,g,o,e,r,b,f,i,p;k=h.backbone;n=h.underscore;g=h.channel;o=h.radio;e=h.control;r=(function(){return{}}());b=new k.Collection();b.on('change',function(a){var c=n.clone(a.attributes),d=a.id;if(!e){throw"BackboneCollection is not mutable by user. The model with id "+a.id+" has been changed";}else{delete c.id;e.update(g,d,c)}});f={add:b.add,remove:b.remove,reset:b.reset,set:b.set};i={add:function(a){e.insert(g,a)},remove:function(a){e.remove(g,a.id)},set:function(a){e.set(g,a)}};i.reset=i.set;(function(d){var m=true,l=function(c){d[c]=(function(a){return function(){if(m){if(!e){throw"BackboneCollection is not mutable by user.";}else{i[a].apply(i,arguments)}}else{return f[a].apply(b,arguments)}}}(c))};f.asPublic=function(a){m=false;a();m=true};l('add');l('remove');l('reset');l('set')}(b));p=j.Binder({set:function(d){f.asPublic(function(){var a=[],c;for(c=0;c<d.length;c+=1){a.push(new k.Model(d[c]))}b.set(a)})},insert:function(a){f.asPublic(function(){b.add(new k.Model(a))})},update:function(c,d){f.asPublic(function(){var a=b.get(c);a.clear({silent:true});a.set(d,{silent:true})})},remove:function(c){f.asPublic(function(){var a=b.get(c);b.remove(a)})}});o.tune(g,p);return b}}());if(j.Backbone===undefined){j.Backbone={}}j.Backbone.Collection=q}(window.Transistor));
|
@@ -7,9 +7,10 @@ if (window.Transistor === undefined) {
|
|
7
7
|
(function (transistor) {
|
8
8
|
var BackboneCollection = (function () {
|
9
9
|
return function (options) {
|
10
|
-
var Backbone, channel, radio, control, H, backbone_collection, collection_interface, control_interface, binder;
|
10
|
+
var Backbone, U, channel, radio, control, H, backbone_collection, collection_interface, control_interface, binder;
|
11
11
|
|
12
12
|
Backbone = options.backbone;
|
13
|
+
U = options.underscore;
|
13
14
|
channel = options.channel;
|
14
15
|
radio = options.radio;
|
15
16
|
control = options.control;
|
@@ -22,7 +23,7 @@ if (window.Transistor === undefined) {
|
|
22
23
|
|
23
24
|
backbone_collection = new Backbone.Collection();
|
24
25
|
backbone_collection.on('change', function (model) {
|
25
|
-
var entry =
|
26
|
+
var entry = U.clone(model.attributes),
|
26
27
|
id = model.id;
|
27
28
|
|
28
29
|
if (!control) {
|
@@ -7,9 +7,10 @@ if (window.Transistor === undefined) {
|
|
7
7
|
(function (transistor) {
|
8
8
|
var BackboneCollection = (function () {
|
9
9
|
return function (options) {
|
10
|
-
var Backbone, channel, radio, control, H, backbone_collection, collection_interface, control_interface, binder;
|
10
|
+
var Backbone, U, channel, radio, control, H, backbone_collection, collection_interface, control_interface, binder;
|
11
11
|
|
12
12
|
Backbone = options.backbone;
|
13
|
+
U = options.underscore;
|
13
14
|
channel = options.channel;
|
14
15
|
radio = options.radio;
|
15
16
|
control = options.control;
|
@@ -22,7 +23,7 @@ if (window.Transistor === undefined) {
|
|
22
23
|
|
23
24
|
backbone_collection = new Backbone.Collection();
|
24
25
|
backbone_collection.on('change', function (model) {
|
25
|
-
var entry =
|
26
|
+
var entry = U.clone(model.attributes),
|
26
27
|
id = model.id;
|
27
28
|
|
28
29
|
if (!control) {
|
@@ -7,9 +7,10 @@ if (window.Transistor === undefined) {
|
|
7
7
|
(function (transistor) {
|
8
8
|
var BackboneCollection = (function () {
|
9
9
|
return function (options) {
|
10
|
-
var Backbone, channel, radio, control, H, backbone_collection, collection_interface, control_interface, binder;
|
10
|
+
var Backbone, U, channel, radio, control, H, backbone_collection, collection_interface, control_interface, binder;
|
11
11
|
|
12
12
|
Backbone = options.backbone;
|
13
|
+
U = options.underscore;
|
13
14
|
channel = options.channel;
|
14
15
|
radio = options.radio;
|
15
16
|
control = options.control;
|
@@ -22,7 +23,7 @@ if (window.Transistor === undefined) {
|
|
22
23
|
|
23
24
|
backbone_collection = new Backbone.Collection();
|
24
25
|
backbone_collection.on('change', function (model) {
|
25
|
-
var entry =
|
26
|
+
var entry = U.clone(model.attributes),
|
26
27
|
id = model.id;
|
27
28
|
|
28
29
|
if (!control) {
|
@@ -21,6 +21,7 @@ describe("Transistor.Backbone.Collection", function () {
|
|
21
21
|
|
22
22
|
collection = new Transistor.Backbone.Collection({
|
23
23
|
backbone: Backbone,
|
24
|
+
underscore: _,
|
24
25
|
channel: 'news',
|
25
26
|
radio: radio
|
26
27
|
})
|
@@ -55,7 +56,10 @@ describe("Transistor.Backbone.Collection", function () {
|
|
55
56
|
model.set('a', 0);
|
56
57
|
}).toThrow(new Error('BackboneCollection is not mutable by user. The model with id 100 has been changed'));
|
57
58
|
|
58
|
-
|
59
|
+
// TODO: the change should be without effect:
|
60
|
+
// assertEqual(2, collection.get(100).get('a'));
|
61
|
+
|
62
|
+
assertEqual(0, collection.get(100).get('a'));
|
59
63
|
});
|
60
64
|
});
|
61
65
|
|
@@ -78,6 +82,7 @@ describe("Transistor.Backbone.Collection", function () {
|
|
78
82
|
|
79
83
|
collection = Transistor.Backbone.Collection({
|
80
84
|
backbone: Backbone,
|
85
|
+
underscore: _,
|
81
86
|
channel: 'news',
|
82
87
|
radio: radio,
|
83
88
|
control: control
|
@@ -31,7 +31,7 @@ describe("Transistor.Radio", function () {
|
|
31
31
|
});
|
32
32
|
});
|
33
33
|
|
34
|
-
waits(
|
34
|
+
waits(200);
|
35
35
|
|
36
36
|
runs(function () {
|
37
37
|
assertEqual(calls.length, 1);
|
@@ -58,7 +58,7 @@ describe("Transistor.Radio", function () {
|
|
58
58
|
});
|
59
59
|
});
|
60
60
|
|
61
|
-
waits(
|
61
|
+
waits(200);
|
62
62
|
|
63
63
|
runs(function () {
|
64
64
|
assertEqual(calls.length, 1);
|
@@ -85,7 +85,7 @@ describe("Transistor.Radio", function () {
|
|
85
85
|
});
|
86
86
|
});
|
87
87
|
|
88
|
-
waits(
|
88
|
+
waits(200);
|
89
89
|
|
90
90
|
runs(function () {
|
91
91
|
channel_path = '/station_uid/token/test/channel'
|
@@ -99,7 +99,7 @@ describe("Transistor.Radio", function () {
|
|
99
99
|
faye['with_collection'].publish(channel_path, message)
|
100
100
|
});
|
101
101
|
|
102
|
-
waits(
|
102
|
+
waits(200);
|
103
103
|
|
104
104
|
runs(function () {
|
105
105
|
assertEqual(calls.length, 2);
|
data/transistor.gemspec
CHANGED