$1 for Node/browserify
This is a simple wrapper around shape detector library $1 (1dollar.js).
Install
npm install one-dollar
Usage
Verbose (original API)
const OneDollar = const recognizer = const result = recognizer console// Result { Name: 'caret', Score: 0.7524355578423304 }
Shorter API
Original API is quite weird : force using new Point
s, title-cased methods… and it's way too verbose.
This module proposes a shortcut for faster access to what you want:
const OneDollar = const recognize = const result = console// Result { name: 'caret', score: 0.7524355578423304 }
Differences from original API:
- no
new OneDollar.DollarRecognizer
, the function returns directly a recognition function- This function accepts
[x, y]
instead ofnew OneDollar.Point(x, y)
(you can still instanciate points, if you really want) - This function returns object with lower-cased properties (
{name, score}
instead of{Name, Score}
) - In case of no match, the result's name is
nomatch
instead ofNo match.
- This function accepts
- you still have access to original methods, but they're camelcased:
recognize.recognize
instead ofrecognizer.Recognize
recognize.addGesture
instead ofrecognizer.AddGesture
recognize.deleteUserGestures
instead ofrecognizer.DeleteUserGestures
recognize.gestures
instead ofrecognizer.Unistrokes
to list user gestures- Note that those methods are the original ones, and will require
Point
instances