Skip to content

Commit 53625ab

Browse files
authored
Merge pull request #41 from TizenTeam/sandbox/rzr/review/master
Update value before ready callback on input
2 parents 6238bbf + 1cb1a63 commit 53625ab

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

lib/gpio.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,15 @@ var GPIO = function(headerNum, opts) {
111111
this.export(function() {
112112
var onSuccess = function() {
113113
self.setDirection(dir, function () {
114-
if(typeof opts.ready === 'function') opts.ready.call(self);
114+
if ( dir === "out") {
115+
if(typeof opts.ready === 'function') opts.ready.call(self);
116+
} else {
117+
self.value = undefined;
118+
self._get(function(val) {
119+
self.value = val;
120+
if (typeof opts.ready === 'function') opts.ready.call(self);
121+
});
122+
}
115123
});
116124
};
117125
var attempts = 0;

0 commit comments

Comments
 (0)