Skip to content

Taggd

new Taggd(image, [options], [data])

Create a new taggd instance

ParamTypeDefaultDescription
imageHTMLElementThe image to wrap
[options]Object{}The options
[data]Array[]The tags

taggd.on(eventName, handler)

Subscribe to an event.

Kind: instance method of Taggd
Returns: Taggd - Current Taggd instance

ParamTypeDescription
eventNameStringThe event to subscribe to.
handlerfunctionThe handler to execute.

taggd.off(eventName, handler)

Unsubscribe from an event.

Kind: instance method of Taggd
Returns: Taggd - Current Taggd instance

ParamTypeDescription
eventNameStringThe event to unsubscribe from.
handlerfunctionThe handler that was used to subscribe.

taggd.once(eventName, handler)

Subscribe to an event and unsubscribe once triggered.

Kind: instance method of Taggd
Returns: Taggd - Current Taggd instance

ParamTypeDescription
eventNameStringThe event to subscribe to.
handlerfunctionThe handler to execute.

taggd.setOptions(options)

Set taggd options

Kind: instance method of Taggd
Returns: Taggd - Current Taggd instance

ParamTypeDescription
optionsObjectThe options to set

taggd.addTag(tag)

Add a single tag

Kind: instance method of Taggd
Returns: Taggd - Current Taggd instance

ParamTypeDescription
tagTaggd.TagThe tag to add

taggd.getTag(index)

Get a single tag by index

Kind: instance method of Taggd
Returns: Taggd.Tag - The tag to get

ParamTypeDescription
indexNumberThe index of the desired tag

taggd.deleteTag(index)

Delete a single tag by index

Kind: instance method of Taggd
Returns: Taggd - Current Taggd instance

ParamTypeDescription
indexNumberThe index of the desired tag

taggd.setTags(tags)

Set all tags

Kind: instance method of Taggd
Returns: Taggd - Current Taggd instance

ParamTypeDescription
tagsArray.<Taggd.Tag>An array of tags

taggd.addTags(tags)

Add multiple tags

Kind: instance method of Taggd
Returns: Taggd - Current Taggd instance

ParamTypeDescription
tagsArray.<Taggd.Tag>An array of tags

taggd.getTags()

Get all tags

Kind: instance method of Taggd
Returns: Array.<Taggd.Tag> - All tags of this Taggd instance

taggd.deleteTags()

Remove all tags

Kind: instance method of Taggd
Returns: Taggd - Current Taggd instance

taggd.map(callback)

Iterate and replace all tags

Kind: instance method of Taggd
Returns: Taggd - Current Taggd instance

ParamTypeDescription
callbackfunctionThe callback to execute for all tags

taggd.toJSON()

Get all tags json

Kind: instance method of Taggd
Returns: Array - A array for JSON

taggd.destroy()

Clean up memory

Kind: instance method of Taggd
Returns: Taggd - Current Taggd instance

taggd.enableEditorMode()

Enable editor mode

Kind: instance method of Taggd
Returns: Taggd - Current Taggd instance

taggd.disableEditorMode()

Disable editor mode

Kind: instance method of Taggd
Returns: Taggd - Current Taggd instance