Via plain JS, no, but the C++ SDK provides some examples on how to do it.
Do you know where I can find this examples?
You need to download the SDK which has lots of documentation and examples. This page has SDKs through CS6. I'm not sure why it doesn't have CC, but the SDK has not changed very much.
The C++ SDK forum is the best place to ask more questions.