-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Arbitrary event argument type in CLI #134
Comments
Actually, it is more of a workaround for the fact, that JSTP in its current implementation does not allow to seamlessly pass multiple arguments when emitting the event (like in Also, current approach implemented in the CLI is not really inconsistent with the specification, here is
As you can see, So, to make implementation compliant with the current specification, we should allow user to provide only one array or one object as argument when sending an event. But to make our CLI more user-friendly I propose to allow users to drop square braces when they want to send an array by default, allowing for |
I think we should change jstp according to the first statement and make square braces optional in |
@aqrln ping. |
@lundibundi pong. What @belochub said sounds reasonable to me, so I'm in favor of changing this. |
@belochub @lundibundi I've created a new issue for the alternative approach, but let's keep this one open until a PR that resolves either of them lands. My motivation is that whichever side we take and whether we treat this as a bug in the CLI or as a bad design decision in the protocol that the CLI implementers were not aware of, at this point we have the CLI and the remote events facilities in the library itself that don't understand each other. |
Changes event message signature to always send an array of arbitrary arguments. This makes it work same way as EventEmitter does and also makes its usage similar to call action. PR-URL: #187 Fixes: #134 Fixes: #162 Reviewed-By: Alexey Orlenko <eaglexrlnk@gmail.com> Reviewed-By: Mykola Bilochub <nbelochub@gmail.com>
Changes event message signature to always send an array of arbitrary arguments. This makes it work same way as EventEmitter does and also makes its usage similar to call action. PR-URL: #187 Fixes: #134 Fixes: #162 Reviewed-By: Alexey Orlenko <eaglexrlnk@gmail.com> Reviewed-By: Mykola Bilochub <nbelochub@gmail.com>
Changes event message signature to always send an array of arbitrary arguments. This makes it work same way as EventEmitter does and also makes its usage similar to call action. PR-URL: metarhia/jstp#187 Fixes: metarhia/jstp#134 Fixes: metarhia/jstp#162 Reviewed-By: Alexey Orlenko <eaglexrlnk@gmail.com> Reviewed-By: Mykola Bilochub <nbelochub@gmail.com>
Changes event message signature to always send an array of arbitrary arguments. This makes it work same way as EventEmitter does and also makes its usage similar to call action. PR-URL: metarhia/jstp#187 Fixes: metarhia/jstp#134 Fixes: metarhia/jstp#162 Reviewed-By: Alexey Orlenko <eaglexrlnk@gmail.com> Reviewed-By: Mykola Bilochub <nbelochub@gmail.com>
The JSTP CLI always passes the arguments of the
event
command as an array to theConnection#emitRemoteEvent
method, while it should be an arbitrary JavaScript value. If user wants it to be an array, they must explicitly pass an array. In fact, this argument is an object in most cases.This behavior may change in the future when we have metadata, so the approach implemented in the CLI may be not as incorrect as too forward-looking, but for now it is both inconsistent with the specification and making it impossible to use in the real cases that we have in our apps.
Ref: #132 (comment)
The text was updated successfully, but these errors were encountered: