NearField Component
Properties
lastMessage Returns the content of the most recently received tag.
| Data type: string |
||
| Designer Writable | false | |
| Code Writeable | false | |
| Code Readable | true |
let variable = nearfieldName.lastMessage |
readMode Specifies whether the NFC hardware should operate in read mode (true) or write mode (false)
| Data type: boolean |
||
| Designer Writable | true |
<nearfield name="nearfieldName" readMode="true"> |
| Code Writeable | true |
nearfieldName.readMode = true |
| Code Readable | true |
let variable = nearfieldName.readMode |
textToWrite Specifies the content that will be written to the tag when in write mode. This method has no effect if ReadMode is true.
| Data type: string |
||
| Designer Writable | false | |
| Code Writeable | true |
nearfieldName.textToWrite = "Test textToWrite" |
| Code Readable | true |
let variable = nearfieldName.textToWrite |
writeType Returns the write type for the NFC component. For this version of the component, it is always 1.
| Data type: number |
||
| Designer Writable | false | |
| Code Writeable | false | |
| Code Readable | true |
let variable = nearfieldName.writeType |
class The styling class of the the component
| Data type: string |
||
| Designer Writable | true |
<nearfield name="nearfieldName" class="Test class"> |
| Code Writeable | false | |
| Code Readable | false | |
id The styling id of the the component
| Data type: string |
||
| Designer Writable | true |
<nearfield name="nearfieldName" id="Test id"> |
| Code Writeable | false | |
| Code Readable | false | |
name The name of the component that will be used to refer to it in code.
| Data type: string |
||
| Designer Writable | true |
<nearfield name="nearfieldName" name="testComponent"> |
| Code Writeable | false | |
| Code Readable | false | |
Methods
| Method name | Description | Parameters | ||||
|---|---|---|---|---|---|---|
| addEventListener |
Method used to create event listeners. See Events below for samples. |
|
Events
| Event name | Description | Parameters | ||
|---|---|---|---|---|
| tagRead | Indicates that a new tag has been detected. Currently this is only a plain text tag, as specified in the manifest.
nearfieldName.addEventListener(
"tagRead",
function (message) {
//Your code here
}
)
|
|
||
| tagWritten | Indicates that a tag has come into range of the NFC sensor and has been written.
nearfieldName.addEventListener(
"tagWritten",
function () {
//Your code here
}
)
|
|