BTWrapper Class Reference

Inherits fromObject
ParentNone
ScopeLocal
Available sinceBowtie 1.0 Beta 1
Bowtie Touch 2.0

Overview

BTWrapper objects are used to wrap Cocoa dictionaries in a JavaScript-friendly interface. Several Bowtie methods return BTWrapper objects, each with its own set of possible properties. For a list of the properties a method's wrapper supports, see its individual documentation.

Accessing Properties in a BTWrapper

The most common way to access properties is using the property() method. When given a string representing the property you'd like to retrieve, this method returns the unescaped value of the property.

Since Bowtie 1.1, however, there are two other ways to access properties. The first is with the new propertyHTML() method, which functions identically to property(), except that all strings are escaped to be HTML-safe (this is good if you're using this method in conjunction with the innerHTML property of a DOM element). The other option is to access the value directly as a JavaScript property, which has the same effect as using the propertyHTML() method.

// Track: Speed of Sound, by Coldplay on X & Y
var theTrack = Player.currentTrack();

theTrack.property('album');		// returns "X & Y"
theTrack.propertyHTML('album');		// returns "X & Y"
theTrack.album;				// returns "X & Y"

Methods and Properties

(…) Instance Methods property(), propertyHTML()

Instance Methods

property()

Returns the value of a given property.

obj.property(property)

Parameters

property
A string representing the name of the property for which you want a value. Available properties are listed under each method's individual documentation.

Return Value

The value of the property if it exists, or undefined if it does not. The return type of the property() method varies with the property requested.

Availability

Available in Bowtie 1.0 Beta 1 and later.
Available in Bowtie Touch 2.0 and later.

propertyHTML()

Returns the HTML-escaped value of a given property.

obj.propertyHTML(property)

Parameters

property
A string representing the name of the property for which you want a value. Available properties are listed under each method's individual documentation.

Return Value

The HTML-escaped value of the property if it exists, or undefined if it does not. The return type of the propertyHTML() method varies with the property requested.

Availability

Available in Bowtie 1.1 and later.
Available in Bowtie Touch 2.0 and later.