ISSUE-86: There is no way to pass additional arguments to geolocation callbacks
There is no way to pass additional arguments to geolocation callbacks
- State:
- CLOSED
- Product:
- GeoAPI V2
- Raised by:
- Andrei Popescu
- Opened on:
- 2011-02-08
- Description:
- Right now Geolocation API methods accept function callbacks arguments that are invoked by the implementation with a Position or PositionError parameter. However, there is no way to pass any other arguments to these callbacks. This could be useful in the following scenario:
function someGenericCallback(position, someArgument) {
console.log(someArgument);
doSomething(position);
}
navigator.geolocation.getCurrentPosition(someGenericCallback, null, null, "first");
...
navigator.geolocation.getCurrentPosition(someGenericCallback, null, null, "second");
"first" and "second" arguments are bound at the time of the getCurrentPosition() calls so could be used to distinguish which of these one-shot requests fired its callback. The same objective can be achieved without this feature but it is very cumbersome and inelegant.
Note that window.setTimeout provides this ability
http://dev.w3.org/html5/spec/Overview.html#dom-windowtimers-settimeout
so we should consider allowing this, too. - Related Actions Items:
- No related actions
- Related emails:
- No related emails
Related notes:
Closures can be used for this purpose, so no need to do anything here.
Andrei Popescu, 28 Jun 2011, 13:41:07Display change log