Skip to content

Commit f3f0bbd

Browse files
Marco Sparagnalukeed
Marco Sparagna
authored andcommitted
Add json() method (#4)
* Added sendJSON function that will automatically stringify the json object for you * rename `sendJSON` to `json` * rewrite: use ws directly & remove return statement Calls to `ws.send` don't return anything, so there's no need to return anything either~
1 parent d2421ed commit f3f0bbd

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/index.js

+4
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,9 @@ export default function (url, opts) {
3232
}, ms);
3333
};
3434

35+
$.json = x => {
36+
ws.send(JSON.stringify(x));
37+
}
38+
3539
return $.open();
3640
}

0 commit comments

Comments
 (0)