chariotsolutions / phonegap-nfc

PhoneGap NFC Plugin
MIT License
712 stars 570 forks source link

Make RTD_* constants Strings not Arrays #68

Closed don closed 6 years ago

don commented 11 years ago

Comparing types to RTD_* constants is clunky since arrays can't be compared.

This change will make the JavaScript more convenient

Converting the constants to Strings is OK, since most constructors now take Strings or [] and convert appropriately.

The native implementations probably don't need to change.

I haven't see a case where Type is not a String. Need to check the specs, but it would be nice if record.type and record.id could be strings and only payload would be a byte array.

/cc @tigoe

tigoe commented 11 years ago

On Mar 3, 2013, at 8:58 PM, Don Coleman wrote:

Comparing types to RTD_* constants is clunky since arrays can't be compared.

This change will make the JavaScript more convenient

Converting the constants to Strings is OK, since most constructors now take Strings or [] and convert appropriately.

Exactly my thinking.

The native implementations probably don't need to change.

Sweet.

I haven't see a case where Type is not a String. Need to check the specs, but it would be nice if record.type and record.id could be strings and only payload would be a byte array.

I don't see any reason why not. Will do a double check on the spec tonight.

/cc @tigoe

— Reply to this email directly or view it on GitHub.

don commented 10 years ago

see similar change in ndef-js https://github.com/don/ndef-js/commit/f07d428dc5522c850d0f3e404fd21f1a78142b21

don commented 6 years ago

Closing old issue