Skip to content

Commit

Permalink
Merge pull request #66 from dtex/servoTests
Browse files Browse the repository at this point in the history
Servo tests
  • Loading branch information
dtex authored Jul 11, 2020
2 parents da4e37b + 505b404 commit cae504e
Show file tree
Hide file tree
Showing 7 changed files with 275 additions and 136 deletions.
4 changes: 2 additions & 2 deletions docs/fn_index.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -361,8 +361,8 @@ <h1><span class="name">fn/index.js</span></h1>
* @param {function} callback
*/
setImmediate(callback) {
if (typeof process !== "undefined" &amp;&amp; process.setImmediate) {
setImmediate(callback);
if (typeof process !== "undefined" &amp;&amp; global.setImmediate) {
global.setImmediate(callback);
}
if (typeof System !== "undefined" &amp;&amp; System.setTimeout) {
System.setTimeout(callback);
Expand Down
20 changes: 10 additions & 10 deletions docs/module-j5e_servo-Servo.html
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ <h5>Parameters</h5>
<div class="form-group">
<label class="col-sm-3 control-label">Source</label>
<div class="col-sm-9">
<p class="form-control-static"><a href="servo_index.js.html">servo/index.js</a>, <a href="servo_index.js.html#line-205">line 205</a></p>
<p class="form-control-static"><a href="servo_index.js.html">servo/index.js</a>, <a href="servo_index.js.html#line-203">line 203</a></p>
</div>
</div>

Expand Down Expand Up @@ -602,7 +602,7 @@ <h5>Parameters</h5>
<div class="form-group">
<label class="col-sm-3 control-label">Source</label>
<div class="col-sm-9">
<p class="form-control-static"><a href="servo_index.js.html">servo/index.js</a>, <a href="servo_index.js.html#line-307">line 307</a></p>
<p class="form-control-static"><a href="servo_index.js.html">servo/index.js</a>, <a href="servo_index.js.html#line-305">line 305</a></p>
</div>
</div>

Expand Down Expand Up @@ -684,7 +684,7 @@ <h5>Parameters</h5>
<div class="form-group">
<label class="col-sm-3 control-label">Source</label>
<div class="col-sm-9">
<p class="form-control-static"><a href="servo_index.js.html">servo/index.js</a>, <a href="servo_index.js.html#line-329">line 329</a></p>
<p class="form-control-static"><a href="servo_index.js.html">servo/index.js</a>, <a href="servo_index.js.html#line-327">line 327</a></p>
</div>
</div>

Expand Down Expand Up @@ -766,7 +766,7 @@ <h5>Parameters</h5>
<div class="form-group">
<label class="col-sm-3 control-label">Source</label>
<div class="col-sm-9">
<p class="form-control-static"><a href="servo_index.js.html">servo/index.js</a>, <a href="servo_index.js.html#line-351">line 351</a></p>
<p class="form-control-static"><a href="servo_index.js.html">servo/index.js</a>, <a href="servo_index.js.html#line-349">line 349</a></p>
</div>
</div>

Expand Down Expand Up @@ -858,7 +858,7 @@ <h5>Parameters</h5>
<div class="form-group">
<label class="col-sm-3 control-label">Source</label>
<div class="col-sm-9">
<p class="form-control-static"><a href="servo_index.js.html">servo/index.js</a>, <a href="servo_index.js.html#line-383">line 383</a></p>
<p class="form-control-static"><a href="servo_index.js.html">servo/index.js</a>, <a href="servo_index.js.html#line-381">line 381</a></p>
</div>
</div>

Expand Down Expand Up @@ -915,7 +915,7 @@ <h4 id="home" class="function public"><span class="name">home</span><span class=
<div class="form-group">
<label class="col-sm-3 control-label">Source</label>
<div class="col-sm-9">
<p class="form-control-static"><a href="servo_index.js.html">servo/index.js</a>, <a href="servo_index.js.html#line-402">line 402</a></p>
<p class="form-control-static"><a href="servo_index.js.html">servo/index.js</a>, <a href="servo_index.js.html#line-400">line 400</a></p>
</div>
</div>

Expand Down Expand Up @@ -1000,7 +1000,7 @@ <h5>Parameters</h5>
<div class="form-group">
<label class="col-sm-3 control-label">Source</label>
<div class="col-sm-9">
<p class="form-control-static"><a href="servo_index.js.html">servo/index.js</a>, <a href="servo_index.js.html#line-429">line 429</a></p>
<p class="form-control-static"><a href="servo_index.js.html">servo/index.js</a>, <a href="servo_index.js.html#line-427">line 427</a></p>
</div>
</div>

Expand Down Expand Up @@ -1049,7 +1049,7 @@ <h4 id="stop" class="function public"><span class="name">stop</span><span class=
<div class="form-group">
<label class="col-sm-3 control-label">Source</label>
<div class="col-sm-9">
<p class="form-control-static"><a href="servo_index.js.html">servo/index.js</a>, <a href="servo_index.js.html#line-472">line 472</a></p>
<p class="form-control-static"><a href="servo_index.js.html">servo/index.js</a>, <a href="servo_index.js.html#line-470">line 470</a></p>
</div>
</div>

Expand Down Expand Up @@ -1131,7 +1131,7 @@ <h5>Parameters</h5>
<div class="form-group">
<label class="col-sm-3 control-label">Source</label>
<div class="col-sm-9">
<p class="form-control-static"><a href="servo_index.js.html">servo/index.js</a>, <a href="servo_index.js.html#line-507">line 507</a></p>
<p class="form-control-static"><a href="servo_index.js.html">servo/index.js</a>, <a href="servo_index.js.html#line-505">line 505</a></p>
</div>
</div>

Expand Down Expand Up @@ -1213,7 +1213,7 @@ <h5>Parameters</h5>
<div class="form-group">
<label class="col-sm-3 control-label">Source</label>
<div class="col-sm-9">
<p class="form-control-static"><a href="servo_index.js.html">servo/index.js</a>, <a href="servo_index.js.html#line-531">line 531</a></p>
<p class="form-control-static"><a href="servo_index.js.html">servo/index.js</a>, <a href="servo_index.js.html#line-529">line 529</a></p>
</div>
</div>

Expand Down
8 changes: 3 additions & 5 deletions docs/servo_index.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -217,12 +217,10 @@ <h1><span class="name">servo/index.js</span></h1>
this.to(options.startAt);
} else {

if (options.center) {
this.center();
}

if (options.type === "continuous") {
this.stop();
} else {
this.center();
}

}
Expand Down Expand Up @@ -646,7 +644,7 @@ <h1><span class="name">servo/index.js</span></h1>
};
}

// If user passes a step as the first element in keyFrames use current position + step
// If user passes a number as the first element in keyFrames make it a step
if (typeof keyFrames[0] === "number") {
keyFrames[0] = {
value: last + keyFrames[0]
Expand Down
4 changes: 2 additions & 2 deletions lib/fn/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -265,8 +265,8 @@ export const timer = Object.freeze({
* @param {function} callback
*/
setImmediate(callback) {
if (typeof process !== "undefined" && process.setImmediate) {
setImmediate(callback);
if (typeof process !== "undefined" && global.setImmediate) {
global.setImmediate(callback);
}
if (typeof System !== "undefined" && System.setTimeout) {
System.setTimeout(callback);
Expand Down
8 changes: 3 additions & 5 deletions lib/servo/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,10 @@ class Servo extends Emitter {
this.to(options.startAt);
} else {

if (options.center) {
this.center();
}

if (options.type === "continuous") {
this.stop();
} else {
this.center();
}

}
Expand Down Expand Up @@ -550,7 +548,7 @@ class Servo extends Emitter {
};
}

// If user passes a step as the first element in keyFrames use current position + step
// If user passes a number as the first element in keyFrames make it a step
if (typeof keyFrames[0] === "number") {
keyFrames[0] = {
value: last + keyFrames[0]
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "j5e",
"version": "0.4.5",
"version": "0.4.6",
"description": "j5e is a device framework built for ECMA TC-53's IO pattern",
"main": "index.js",
"exports": {
Expand Down
Loading

0 comments on commit cae504e

Please sign in to comment.