What's the difference between 'state' and 'status' in function name?
readyState
statusText on开发者_如何学运维readystatechange window.statusWhat's the difference between 'state' and 'status' in English ?
Not much. I would tend to say state refers to more detailed information, but that's subjective.
For these:
XMLHttpRequest.readyState - one of 5 possible states for a request
XMLHttpRequest.statusText - The text equivalent of the HTTP response status (e.g. "200 OK")
XMLHttpRequest.onreadystatechange - function to call when readyState changes
window.status - status bar text (typically bottom left of window)
They are quite similar, as they both signify the current properties of something. There is however a bit of a difference in how they are used:
A state is usually a single propery with some specific possible values. The readyState
for example will cycle through some specific predefined values when a page loads.
The status is usually a collection of properties, or a description of them. The window.status
property for example is just the text that is displayed in the status bar, and that can descibe any aspect of the content.
In computing there is not much difference between the two, and they can be used interchangeably.
See status and state on wikipedia (the computing sections) - not much of a difference, and the status
article even points to state
articles.
status
in window.status
points to the status bar of the browser. In pure English though, i don't see much difference between state
and status
.
Just a humble tought: It could help thinking to readyState in a finite state machine fashion. I mean, when a page loads, It goes from a state to another (and not from a status to another status). Maybe this explain why they have decided to call It state.
精彩评论