Skip to content

Commit ecf6cdc

Browse files
author
Vlad Balin
committed
moved valueLink to nestedreact
1 parent 28747ee commit ecf6cdc

File tree

2 files changed

+4
-33
lines changed

2 files changed

+4
-33
lines changed

src/main.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ var Store = require( './store' );
2020
Object.defineProperty( exports, 'store', Store.globalProp );
2121

2222
_.extend( exports, Backbone, {
23+
Backbone : Backbone,
2324
Class : require( './object+' ),
2425
error : require( './errors' ),
2526
attribute : attribute,
@@ -29,7 +30,7 @@ _.extend( exports, Backbone, {
2930
return attribute( { value : value } );
3031
},
3132

32-
valueLink : relations.valueLink,
33+
parseReference : relations.parseReference,
3334

3435
Collection : Collection,
3536
Model : Model,

src/relations.js

Lines changed: 2 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ function parseReference( collectionRef ){
2323
}
2424
}
2525

26+
exports.parseReference = parseReference;
27+
2628
var TakeAttribute = attribute.Type.extend( {
2729
clone : function( value ){ return value; },
2830
isChanged : function( a, b ){ return a !== b; },
@@ -65,38 +67,6 @@ exports.take = function( reference ){
6567
return options;
6668
};
6769

68-
exports.valueLink = function( reference ){
69-
var getMaster = parseReference( reference );
70-
71-
function setLink( value ){
72-
var link = getMaster.call( this );
73-
link && link.requestChanges( value );
74-
}
75-
76-
function getLink(){
77-
var link = getMaster.call( this );
78-
return link && link.value;
79-
}
80-
81-
var LinkAttribute = attribute.Type.extend( {
82-
createPropertySpec : function(){
83-
return {
84-
// call to optimized set function for single argument. Doesn't work for backbone types.
85-
set : setLink,
86-
87-
// attach get hook to the getter function, if present
88-
get : getLink
89-
}
90-
},
91-
92-
set : setLink
93-
} );
94-
95-
var options = attribute( { toJSON : false } );
96-
options.Attribute = LinkAttribute;
97-
return options;
98-
};
99-
10070
exports.from = function( masterCollection ){
10171
var getMaster = parseReference( masterCollection );
10272

0 commit comments

Comments
 (0)