Closed hypesystem closed 8 years ago
@hypesystem Great job!
Looks good to me -- ran the tests (removed a stray console.log) and they pass =)
However, when I ran the examples/notification.js
, I got a TypeError
because the options
array is null, on this line:
https://github.com/ToothlessGear/node-gcm/pull/234/files#diff-c890425a040068c3e899d1f10233671bR75
The options
is set to null
here:
https://github.com/ToothlessGear/node-gcm/pull/234/files#diff-c890425a040068c3e899d1f10233671bR18
I set it to {}
and the error seems to have been fixed. Do you want me to commit the fix to the branch?
One question though -- why use nextTick
and not invoking the callback
with errors directly?
@eladnava Weird!
I thought it would enter the earlier case in cleanOptions
(the one checking typeof options != "object"
), which returns early: https://github.com/ToothlessGear/node-gcm/pull/234/files#diff-c890425a040068c3e899d1f10233671bR69
Turns out that typeof null;
is "object"
. Great. Will fix :smile:
Fixed in https://github.com/ToothlessGear/node-gcm/pull/234/commits/58dcde17b95eed600fd23c3f0ad345ee77471921
Feel free to merge if you are happy with the code :smile:
Haha, yeah, JS is a bit messed up to say the least. =)
Seems well, all tests pass and I was able to send a notification. Well done! :)
:star: Comments and discussion welcome. :star:
This is some refactoring and code sanitation of the Sender class.
I am very open to feedback. Am I going in the right direction?
Before merging this, we should merge the following into this branch: