Class for the YUI SWFStore util.
Constructor
YAHOO.util.SWFStore
(
containerId
,
shareData
,
useCompression
)
- Parameters:
-
containerId
<HTMLElement>
Container element for the Flash Player instance.
-
shareData
<Boolean>
Whether or not data should be shared across browsers
-
useCompression
<Boolean>
Container element for the Flash Player instance.
Methods
void
addListener
(
type
,
listener
)
Method to attach listeners to events
- Parameters:
-
type
<String>
The tyep of event to listen for
-
listener
<String>
The function to call
Number
calculateCurrentSize
(
)
Gets the current size, in KB, of the amount of space taken by the current store.
Note that this is calculated, and may take time depending on the number of items stored
- Returns:
Number
- The size of the store in KB
void
clear
(
)
Removes all data in local storage for this domain.
Be careful when using this method, as it may
remove stored information that is used by other applications
in this domain
void
displaySettings
(
)
Displays the settings dialog to allow the user to configure
storage settings manually. If the SWF height and width are smaller than
what is allowable to display the local settings panel,
an openExternalDialog message will be sent to JavaScript.
Object
getItems
(
)
Returns the items in storage as an array.
- Returns:
Object
- The data.
Number
getLength
(
)
Returns the number of items in storage, if any.
- Returns:
Number
- The number of items
Date
getModificationDate
(
)
Gets the timestamp of the last store. This value is automatically set when
data is stored.
- Returns:
Date
- A Date object
Boolean
getShareData
(
)
Public accessor to the unique name of the SWFStore instance.
- Returns:
Boolean
- Whether or not data is being shared among browsers
String
getTypeAt
(
location
)
Returns the data type of of the storage.
May be one of the following types:
- boolean
- function
- number
- object
- string
- number
- xml
- Parameters:
-
location
<Number>
The index of the "cookie" or store
- Returns:
String
- The type
String
getTypeOf
(
location
)
Returns the data type of of the storage.
May be one of the following types:
- boolean
- function
- number
- object
- string
- number
- xml
- Parameters:
-
location
<String>
The name of the "cookie" or store
- Returns:
String
- The type
Boolean
getUseCompression
(
)
Public accessor to the unique name of the SWFStore instance.
- Returns:
Boolean
- Whether or compression is being used
Object
getValueAt
(
index
)
Returns the value of the store at the specified index, if any.
- Parameters:
-
index
<Number>
The index of the stored item
- Returns:
Object
- The value of the store at that index
Object
getValueOf
(
location
)
Returns the value of the item in storage, if any.
- Parameters:
-
location
<String>
The name of the "cookie" or store
- Returns:
Object
- The data
Boolean
hasAdequateDimensions
(
)
Determines if SWF's visible area is large enough to fit the settings panel
- Returns:
Boolean
- Whether or not to share among browsers
void
on
(
type
,
listener
)
Method to attach listeners to events
- Parameters:
-
type
<String>
The tyep of event to listen for
-
listener
<String>
The function to call
void
removeItem
(
location
)
Removes the item in storage, if any.
- Parameters:
-
location
<String>
The name of the "cookie" or store
Boolean
setItem
(
data
,
location
)
Saves data to local storage. It returns a String that can
be one of three values: "true" if the storage succeeded; "false" if the user
has denied storage on their machine or storage space allotted is not sufficient.
The size limit for the passed parameters is ~40Kb.
- Parameters:
-
data
<Object>
The data to store
-
location
<String>
The name of the "cookie" or store
- Returns:
Boolean
- Whether or not the save was successful
void
setShareData
(
Whether
)
Public accessor to the unique name of the SWFStore instance.
- Parameters:
-
Whether
<Boolean>
or not to share among browsers
String
setSize
(
value
)
This method requests more storage (if the amount is above 100KB or the current setting).
The request dialog has to be displayed within the Flash player itself
so the SWF it is called from must be visible and at least 215px x 138px (w x h) in size.
- Parameters:
-
value
<Number>
The size, in KB
void
setUseCompression
(
Whether
)
Public accessor to the unique name of the SWFStore instance.
- Parameters:
-
Whether
<Boolean>
or to compress stored data
String
toString
(
)
Public accessor to the unique name of the SWFStore instance.
- Returns:
String
- Unique name of the SWFStore instance.
configureAttribute,
fireBeforeChangeEvent,
fireChangeEvent,
get,
getAttributeConfig,
getAttributeKeys,
refresh,
register,
resetAttributeConfig,
resetValue,
set,
setAttributeConfig,
setAttributes
Events
clear
(
event.type
)
Fires when a store is successfully cleared
- Parameters:
-
event.type
<String>
The event type
error
(
event.type
,
event.message
)
Fires when an error occurs
- Parameters:
-
event.type
<String>
The event type
-
event.message
<String>
The data
inadequateDimensions
(
event.type
)
Fires when a settings dialog is not able to be displayed due to
the SWF not being large enough to show it. In this case, the developer
needs to resize the SWF to width of 215px and height of 138px or above,
or display an external settings page.
- Parameters:
-
event.type
<String>
The event type
openingDialog
(
event.type
)
Fires as the settings dialog displays
- Parameters:
-
event.type
<String>
The event type
quotaExceededError
(
event.type
,
event.message
)
Fires when there is not enough space available to store the data
- Parameters:
-
event.type
<String>
The event type
-
event.message
<String>
The data
save
(
event.type
)
Fires when a store is saved successfully
- Parameters:
-
event.type
<String>
The event type
securityError
(
event.type
,
event.message
)
Fires when the url matching for the security whitelist is invalid.
If no whitelist is used, fires when page's url does not match the embedded swf's url
- Parameters:
-
event.type
<String>
The event type
-
event.message
<String>
The data