You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The reason will be displayed to describe this comment to others. Learn more.
What do you think about replacing the default functions?
Yes, indeed. But the current functions does not fully respect the node API: setInterval and setTiemout need to accept variadic arguments after the timeout, that they pass to the callback evrytime is called.
Since nbind does not support yet variadic arguments, I thought of add an array argument on C++ side, and then on JS side convert rest arguments to array, and pass that to the C++ functions.
The reason will be displayed to describe this comment to others. Learn more.
And also, we should somehow patch the globals only after startLoop, and restore the original after stopLoop,
because our timers need the GUI event loop to be running to work.
bcbe5c1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only Cocoa is needed, but this needs to be imported in timer.h because of
typedef NSTimer *TIMER_HANDLE;
However, timer.cc includes that file and importing Objective-C headers in an C++ file doesn't work.
bcbe5c1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just discovered :-(
bcbe5c1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I switched to
void*
bcbe5c1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It compile on Travis... Could you check if it's working on macOS?
bcbe5c1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works.
What do you think about replacing the default functions?
index.js:
bcbe5c1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, indeed. But the current functions does not fully respect the node API: setInterval and setTiemout need to accept variadic arguments after the timeout, that they pass to the callback evrytime is called.
Since nbind does not support yet variadic arguments, I thought of add an array argument on C++ side, and then on JS side convert rest arguments to array, and pass that to the C++ functions.
bcbe5c1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to do the trick.
bcbe5c1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From here https://node.green/ it seems from node 6 onwards.
We could do:
bcbe5c1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would work without any C++ changes:
bcbe5c1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And also, we should somehow patch the globals only after startLoop, and restore the original after stopLoop,
because our timers need the GUI event loop to be running to work.
bcbe5c1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's working on windows too...
bcbe5c1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sadly, the clang-format is not working on windows, we should at least add a note somewhere on README or documentation.
bcbe5c1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See e6387d8
bcbe5c1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How exactly? Related to this: ? angular/clang-format#25
bcbe5c1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nevermind, I didn't install it from http://llvm.org/builds/ as specified in clang-format docs...