balderdashy / sails.io.js

Browser SDK for communicating w/ Sails via sockets
https://sailsjs.com/documentation/reference/web-sockets/socket-client
183 stars 118 forks source link

Issue with 'delete' reserved word in IE8 #6

Closed larsonjj closed 10 years ago

larsonjj commented 10 years ago

There is an issue with using delete for object property names in IE8. It will throw an error saying Expected Identifier.

I made some changes to make any object delete properties use the bracket notation instead of dot notation as that will take care of the issue for the time being.

I would suggest maybe change the property names to something other than delete going forward though, as it is not very pleasant to have to write socket['delete']. Maybe remove as a property name would be better?

mikermcneil commented 10 years ago

@larsonjj nice catch, thanks!

I would suggest maybe change the property names to something other than delete going forward though, as it is not very pleasant to have to write socket['delete']. Maybe remove as a property name would be better?

This is why we ended up calling it destroy in Sails on the backend. But since the delete method really is a simulation of an HTTP DELETE, I don't want to make things confusing by overloading the destroy term (since you could really have any logic you like hooked up an HTTP delete route-- not saying that would be a good idea :) )

How about keeping the official usage as io.socket.delete(), but adding a synonym as io.socket.del()?

larsonjj commented 10 years ago

io.socket.del() as a synonym sounds good to me :+1: