Skip to content

Commit b66d725

Browse files
committed
switch to error second callbacks
1 parent 90d6e6f commit b66d725

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

examples/NeuralNetwork-mouse-gesture/sketch.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ function mouseReleased() {
7575
}
7676

7777
// Step 9: define a function to handle the results of your classification
78-
function gotResults(error, results) {
78+
function gotResults(results) {
7979
label = results[0].label;
8080
console.log(results);
8181
}

src/utils/callcallback.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
// This software is released under the MIT License.
44
// https://opensource.org/licenses/MIT
55

6-
76
/**
87
* Most ml5 methods accept a callback function which will be
98
* called with the arguments (error, result).
@@ -29,11 +28,11 @@ export default function callCallback(promise, callback) {
2928
return new Promise((resolve, reject) => {
3029
promise
3130
.then((result) => {
32-
callback(undefined, result);
31+
callback(result);
3332
resolve(result);
3433
})
3534
.catch((error) => {
36-
callback(error);
35+
callback(undefined, error);
3736
reject(error);
3837
});
3938
});

0 commit comments

Comments
 (0)