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:
-
config
ObjectObject 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:
-
action
ObjectObject containing the
state
and actiontype
(undo or redo) to be executed.
_defBeforeActionFn
-
event
This is the default function for the beforeUndo and beforeRedo events.
Parameters:
-
event
EventFacade
_indexParameters
()
protected
Indexes all parameters into the query.
_indexParts
-
url
Indexes all URL parts to its private attributes.
Parameters:
-
url
Object
_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:
-
event
EventFacade
_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:
-
action
ObjectObject containing the
state
and 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:
-
state
Object | FunctionObject that contains
undo
andredo
action methods (and, optionally, a 'merge' method).
addParameter
-
key
-
values
Adds a single parameter in the URL.
Parameters:
-
key
Object -
values
Object
addParameters
-
parameters
Adds a list of parameters in the URL.
Parameters:
-
parameters
Object
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:
-
key
Object
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:
-
key
Object
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:
-
key
Object
removeParameters
-
parameters
Removes a list of parameters from the parameters list.
Parameters:
-
parameters
Object
setAnchor
-
val
Sets the anchor.
Parameters:
-
val
Object
setAuthority
-
val
Sets the authority.
Parameters:
-
val
Object
setDirectory
-
val
Sets the directory.
Parameters:
-
val
Object
setFile
-
val
Sets the file.
Parameters:
-
val
Object
setHost
-
val
Sets the host.
Parameters:
-
val
Object
setParameter
-
key
-
opt_values
Sets a single parameter.
Parameters:
-
key
Object -
opt_values
Object
setParameters
-
parameters
Sets a list of parameters.
Parameters:
-
parameters
Object
setPassword
-
val
Sets the password.
Parameters:
-
val
Object
setPath
-
val
Sets the path.
Parameters:
-
val
Object
setPort
-
val
Sets the port.
Parameters:
-
val
Object
setProtocol
-
val
Sets the protocol.
Parameters:
-
val
Object
setRelative
-
val
Sets the relative.
Parameters:
-
val
Object
setSource
-
val
Sets the source.
Parameters:
-
val
Object
setUser
-
val
Sets the user.
Parameters:
-
val
Object
setUserInfo
-
val
Sets the user info.
Parameters:
-
val
Object
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.