A.Url Class
alloy-ui/src/aui-url/js/aui-url.js:43
A base class for A.Url.
In order to understand what each attribute/method does, you need to see the anatomy of a URL:
foo://example.com:8042/over/there?name=ferret#nose
\_/ \______________/\_________/ \_________/ \__/
Scheme Authority Path Query Anchor
Constructor
A.Url
-
config
Parameters:
-
configObjectObject literal specifying widget configuration properties.
Index
Methods
- _afterAction
- _defBeforeActionFn
- _indexParameters
- _indexParts
- _makeEventName
- _onRedoKey
- _onUndoKey
- _prevBeforeActionFn
- _removeStatesBeyondMaxDepth
- _runAction
- _runNextPendingAction
- _shouldIgnoreNewActions
- _tryMerge
- add
- addParameter
- addParameters
- canRedo
- canUndo
- clearHistory
- getAnchor
- getAuthority
- getDirectory
- getFile
- getHost
- getParameter
- getParameters
- getPassword
- getPath
- getPort
- getProtocol
- getQuery
- getRelative
- getSource
- getUser
- getUserInfo
- hasParameter
- initializer
- isActionInProgress
- redo
- redoPeek
- removeParameter
- removeParameters
- setAnchor
- setAuthority
- setDirectory
- setFile
- setHost
- setParameter
- setParameters
- setPassword
- setPath
- setPort
- setProtocol
- setRelative
- setSource
- setUser
- setUserInfo
- toString
- undo
- undoPeek
Properties
Attributes
Events
Methods
_afterAction
-
action
Executes right after an action finishes running.
Parameters:
-
actionObjectObject containing the
stateand actiontype(undo or redo) to be executed.
_defBeforeActionFn
-
event
This is the default function for the beforeUndo and beforeRedo events.
Parameters:
-
eventEventFacade
_indexParameters
()
protected
Indexes all parameters into the query.
_indexParts
-
url
Indexes all URL parts to its private attributes.
Parameters:
-
urlObject
_makeEventName
()
String
protected
Constructs the event's name based on its prefix and the action type related to it.
Returns:
Returns the camel case version of prefix plus
actionType.
_prevBeforeActionFn
-
event
This function runs when a beforeUndo or beforeRedo event is prevented.
Parameters:
-
eventEventFacade
_removeStatesBeyondMaxDepth
()
protected
Removes states in the stack if it's over the max depth limit.
_runAction
-
action
Executes the given action (which can be either undo or redo).
Parameters:
-
actionObjectObject containing the
stateand actiontype(undo or redo) to be executed.
_runNextPendingAction
()
protected
Executes the next pending action, if one exists.
_shouldIgnoreNewActions
()
Boolean
protected
Checks if new actions (calls to undo/redo) should be ignored. Actions
should only be ignored if the queueable attribute is false and there
is currently an action in progress.
Returns:
_tryMerge
()
Boolean
protected
Tries to merge the given state to one at the current position in the stack.
Returns:
Returns true if the merge happened and false otherwise.
add
-
state
Adds a state to the stack and makes it the current state. Note that all states that could be redone will be removed from the stack after this. Valid states are objects that have at least 2 functions: undo and redo. These functions can return promises, in which case any subsequent calls will be queued, waiting for all pending promises to end.
Parameters:
-
stateObject | FunctionObject that contains
undoandredoaction methods (and, optionally, a 'merge' method).
addParameter
-
key -
values
Adds a single parameter in the URL.
Parameters:
-
keyObject -
valuesObject
addParameters
-
parameters
Adds a list of parameters in the URL.
Parameters:
-
parametersObject
canRedo
()
Boolean
Checks if it's possible to redo an action.
Returns:
canUndo
()
Boolean
Checks if it's possible to undo an action.
Returns:
clearHistory
()
Resets the stack, clearing all states and pending actions.
getAnchor
()
String
Gets the anchor.
Returns:
getAuthority
()
String
Gets the authority.
Returns:
getDirectory
()
String
Gets the directory.
Returns:
getFile
()
String
Gets the file.
Returns:
getHost
()
String
Gets the host.
Returns:
getParameter
-
key
Gets a single parameter.
Parameters:
-
keyObject
Returns:
getParameters
()
Array
Gets a list of parameters.
Returns:
getPassword
()
String
Gets the password.
Returns:
getPath
()
String
Gets the path.
Returns:
getPort
()
String
Gets the port.
Returns:
getProtocol
()
String
Gets the protocol.
Returns:
getQuery
()
String
Gets the query.
Returns:
getRelative
()
String
Gets the relative.
Returns:
getSource
()
String
Gets the source.
Returns:
getUser
()
String
Gets the user.
Returns:
getUserInfo
()
String
Gets the user info.
Returns:
hasParameter
-
key
Checks if the URL has a parameter.
Parameters:
-
keyObject
Returns:
initializer
()
protected
Constructor for the Undo/Redo component.
isActionInProgress
()
Boolean
Checks if either an undo or a redo action is currently in progress.
Returns:
redo
()
Boolean
Redoes the next state.
Returns:
Returns false if there was no state to be redone and true, otherwise.
redoPeek
()
Boolean
Returns the state that will be redone when calling redo().
Returns:
removeParameter
-
key
Removes a single parameter from the parameters list.
Parameters:
-
keyObject
removeParameters
-
parameters
Removes a list of parameters from the parameters list.
Parameters:
-
parametersObject
setAnchor
-
val
Sets the anchor.
Parameters:
-
valObject
setAuthority
-
val
Sets the authority.
Parameters:
-
valObject
setDirectory
-
val
Sets the directory.
Parameters:
-
valObject
setFile
-
val
Sets the file.
Parameters:
-
valObject
setHost
-
val
Sets the host.
Parameters:
-
valObject
setParameter
-
key -
opt_values
Sets a single parameter.
Parameters:
-
keyObject -
opt_valuesObject
setParameters
-
parameters
Sets a list of parameters.
Parameters:
-
parametersObject
setPassword
-
val
Sets the password.
Parameters:
-
valObject
setPath
-
val
Sets the path.
Parameters:
-
valObject
setPort
-
val
Sets the port.
Parameters:
-
valObject
setProtocol
-
val
Sets the protocol.
Parameters:
-
valObject
setRelative
-
val
Sets the relative.
Parameters:
-
valObject
setSource
-
val
Sets the source.
Parameters:
-
valObject
setUser
-
val
Sets the user.
Parameters:
-
valObject
setUserInfo
-
val
Sets the user info.
Parameters:
-
valObject
toString
()
String
Generates the entire URL based on each attribute.
Returns:
undo
()
Boolean
Undoes the last state.
Returns:
Returns false if there was no state to be undone and true, otherwise.
undoPeek
()
Boolean
Returns the state that will be undone when calling undo().
Returns:
Properties
_currentStateIndex
Number
protected
This index points to the last state that was executed. Calling undo() will undo the state this index points to.
_pendingActions
Array
protected
List of pending actions.
_states
Array
protected
List of states containing undo and redo action methods added by the
user through the add method.
Attributes
Events
afterRedo
Fired after a redo has finished running.
afterUndo
Fired after an undo has finished running.
beforeRedo
Fired right before a redo is run.
beforeUndo
Fired right before an undo is run.