Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
brainfood
/
rivets
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
1c10de2b
authored
2012-10-18 18:04:53 -0700
by
Michael Richards
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Build 0.3.12.
1 parent
ec42165d
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
17 deletions
lib/rivets.js
lib/rivets.min.js
package.json
src/rivets.coffee
lib/rivets.js
View file @
1c10de2
// rivets.js
// version: 0.3.1
1
// version: 0.3.1
2
// author: Michael Richards
// license: MIT
(
function
()
{
...
...
@@ -90,7 +90,7 @@
};
Binding
.
prototype
.
bind
=
function
()
{
var
dependency
,
keypath
,
model
,
_i
,
_len
,
_ref
,
_ref1
;
var
dependency
,
keypath
,
model
,
_i
,
_len
,
_ref
,
_ref1
,
_results
;
if
(
this
.
options
.
bypass
)
{
this
.
sync
();
}
else
{
...
...
@@ -98,9 +98,13 @@
if
(
Rivets
.
config
.
preloadData
)
{
this
.
sync
();
}
if
(
this
.
isBidirectional
())
{
bindEvent
(
this
.
el
,
'change'
,
this
.
publish
);
}
}
if
((
_ref
=
this
.
options
.
dependencies
)
!=
null
?
_ref
.
length
:
void
0
)
{
_ref1
=
this
.
options
.
dependencies
;
_results
=
[];
for
(
_i
=
0
,
_len
=
_ref1
.
length
;
_i
<
_len
;
_i
++
)
{
dependency
=
_ref1
[
_i
];
if
(
/^
\.
/
.
test
(
dependency
))
{
...
...
@@ -111,29 +115,29 @@
model
=
this
.
view
.
models
[
dependency
.
shift
()];
keypath
=
dependency
.
join
(
'.'
);
}
Rivets
.
config
.
adapter
.
subscribe
(
model
,
keypath
,
this
.
sync
);
_results
.
push
(
Rivets
.
config
.
adapter
.
subscribe
(
model
,
keypath
,
this
.
sync
)
);
}
}
if
(
this
.
isBidirectional
())
{
return
bindEvent
(
this
.
el
,
'change'
,
this
.
publish
);
return
_results
;
}
};
Binding
.
prototype
.
unbind
=
function
()
{
var
keypath
,
_i
,
_len
,
_ref
,
_ref1
;
var
keypath
,
_i
,
_len
,
_ref
,
_ref1
,
_results
;
if
(
!
this
.
options
.
bypass
)
{
Rivets
.
config
.
adapter
.
unsubscribe
(
this
.
model
,
this
.
keypath
,
this
.
sync
);
if
((
_ref
=
this
.
options
.
dependencies
)
!=
null
?
_ref
.
length
:
void
0
)
{
_ref1
=
this
.
options
.
dependencies
;
for
(
_i
=
0
,
_len
=
_ref1
.
length
;
_i
<
_len
;
_i
++
)
{
keypath
=
_ref1
[
_i
];
Rivets
.
config
.
adapter
.
unsubscribe
(
this
.
model
,
keypath
,
this
.
sync
);
}
}
if
(
this
.
isBidirectional
())
{
return
this
.
el
.
removeEventListener
(
'change'
,
this
.
publish
);
unbindEvent
(
this
.
el
(
'change'
,
this
.
publish
)
);
}
}
if
((
_ref
=
this
.
options
.
dependencies
)
!=
null
?
_ref
.
length
:
void
0
)
{
_ref1
=
this
.
options
.
dependencies
;
_results
=
[];
for
(
_i
=
0
,
_len
=
_ref1
.
length
;
_i
<
_len
;
_i
++
)
{
keypath
=
_ref1
[
_i
];
_results
.
push
(
Rivets
.
config
.
adapter
.
unsubscribe
(
this
.
model
,
keypath
,
this
.
sync
));
}
return
_results
;
}
};
return
Binding
;
...
...
lib/rivets.min.js
View file @
1c10de2
This diff is collapsed.
Click to expand it.
package.json
View file @
1c10de2
{
"name"
:
"rivets"
,
"description"
:
"Declarative data binding facility."
,
"version"
:
"0.3.1
1
"
,
"version"
:
"0.3.1
2
"
,
"author"
:
"Michael Richards"
,
"url"
:
"http://rivetsjs.com"
,
"main"
:
"./lib/rivets.js"
,
...
...
src/rivets.coffee
View file @
1c10de2
# rivets.js
# version : 0.3.1
1
# version : 0.3.1
2
# author : Michael Richards
# license : MIT
...
...
Please
register
or
sign in
to post a comment