From 0ba66f35ea80924e6b3079b0c2fe588495c6ae0b Mon Sep 17 00:00:00 2001 From: liu-binjun Date: Thu, 22 Sep 2022 21:19:03 +0800 Subject: [PATCH] fixed 515022e from https://gitee.com/liu-binjun/interface_sdk-js/pulls/2831 bugfix:delete ?: Signed-off-by: liu-binjun --- api/@ohos.geolocation.d.ts | 118 +++++++++++++++++++------------------ 1 file changed, 61 insertions(+), 57 deletions(-) diff --git a/api/@ohos.geolocation.d.ts b/api/@ohos.geolocation.d.ts index 0583a89385..fc4619ebec 100644 --- a/api/@ohos.geolocation.d.ts +++ b/api/@ohos.geolocation.d.ts @@ -34,7 +34,7 @@ declare namespace geolocation { * @param request Indicates the location request parameters. * @param callback Indicates the callback for reporting the location result. */ - function on(type: 'locationChange', request: LocationRequest, callback: Callback) : void; + function on(type: 'locationChange', request: LocationRequest, callback: Callback): void; /** * unsubscribe location changed @@ -44,7 +44,7 @@ declare namespace geolocation { * @permission ohos.permission.LOCATION * @param callback Indicates the callback for reporting the location result. */ - function off(type: 'locationChange', callback?: Callback) : void; + function off(type: 'locationChange', callback?: Callback): void; /** * subscribe location switch changed @@ -54,7 +54,7 @@ declare namespace geolocation { * @permission ohos.permission.LOCATION * @param callback Indicates the callback for reporting the location result. */ - function on(type: 'locationServiceState', callback: Callback) : void; + function on(type: 'locationServiceState', callback: Callback): void; /** * unsubscribe location switch changed @@ -64,7 +64,7 @@ declare namespace geolocation { * @permission ohos.permission.LOCATION * @param callback Indicates the callback for reporting the location result. */ - function off(type: 'locationServiceState', callback?: Callback) : void; + function off(type: 'locationServiceState', callback?: Callback): void; /** * subscribe to cache GNSS locations update messages @@ -75,7 +75,7 @@ declare namespace geolocation { * @param request Indicates the cached GNSS locations request parameters. * @param callback Indicates the callback for reporting the cached GNSS locations. */ - function on(type: 'cachedGnssLocationsReporting', request: CachedGnssLocationsRequest, callback: Callback>) : void; + function on(type: 'cachedGnssLocationsReporting', request: CachedGnssLocationsRequest, callback: Callback>): void; /** * unsubscribe to cache GNSS locations update messages @@ -85,7 +85,7 @@ declare namespace geolocation { * @permission ohos.permission.LOCATION * @param callback Indicates the callback for reporting the cached gnss locations. */ - function off(type: 'cachedGnssLocationsReporting', callback?: Callback>) : void; + function off(type: 'cachedGnssLocationsReporting', callback?: Callback>): void; /** * subscribe gnss status changed @@ -95,7 +95,7 @@ declare namespace geolocation { * @permission ohos.permission.LOCATION * @param callback Indicates the callback for reporting the gnss status change. */ - function on(type: 'gnssStatusChange', callback: Callback) : void; + function on(type: 'gnssStatusChange', callback: Callback): void; /** * unsubscribe gnss status changed @@ -105,7 +105,7 @@ declare namespace geolocation { * @permission ohos.permission.LOCATION * @param callback Indicates the callback for reporting the gnss status change. */ - function off(type: 'gnssStatusChange', callback?: Callback) : void; + function off(type: 'gnssStatusChange', callback?: Callback): void; /** * subscribe nmea message changed @@ -115,7 +115,7 @@ declare namespace geolocation { * @permission ohos.permission.LOCATION * @param callback Indicates the callback for reporting the nmea message. */ - function on(type: 'nmeaMessageChange', callback: Callback) : void; + function on(type: 'nmeaMessageChange', callback: Callback): void; /** * unsubscribe nmea message changed @@ -125,7 +125,7 @@ declare namespace geolocation { * @permission ohos.permission.LOCATION * @param callback Indicates the callback for reporting the nmea message. */ - function off(type: 'nmeaMessageChange', callback?: Callback) : void; + function off(type: 'nmeaMessageChange', callback?: Callback): void; /** * add a geofence and subscribe geo fence status changed @@ -136,7 +136,7 @@ declare namespace geolocation { * @param request Indicates the Geo-fence configuration parameters. * @param callback Indicates the callback for reporting the fence status. */ - function on(type: 'fenceStatusChange', request: GeofenceRequest, want: WantAgent) : void; + function on(type: 'fenceStatusChange', request: GeofenceRequest, want: WantAgent): void; /** * remove a geofence and unsubscribe geo fence status changed @@ -147,7 +147,7 @@ declare namespace geolocation { * @param request Indicates the Geo-fence configuration parameters. * @param callback Indicates the callback for reporting the remove fence result. */ - function off(type: 'fenceStatusChange', request: GeofenceRequest, want: WantAgent) : void; + function off(type: 'fenceStatusChange', request: GeofenceRequest, want: WantAgent): void; /** * registering the callback function for listening to country code changes. @@ -156,7 +156,7 @@ declare namespace geolocation { * @syscap SystemCapability.Location.Location.Core * @param callback Indicates the callback for reporting country code changes. */ - function on(type: 'countryCodeChange', callback: Callback) : void; + function on(type: 'countryCodeChange', callback: Callback): void; /** * unregistering the callback function for listening to country code changes. @@ -165,7 +165,7 @@ declare namespace geolocation { * @syscap SystemCapability.Location.Location.Core * @param callback Indicates the callback for reporting country code changes. */ - function off(type: 'countryCodeChange', callback?: Callback) : void; + function off(type: 'countryCodeChange', callback?: Callback): void; /** * obtain current location @@ -175,9 +175,9 @@ declare namespace geolocation { * @permission ohos.permission.LOCATION * @param callback Indicates the callback for reporting the location result. */ - function getCurrentLocation(request: CurrentLocationRequest, callback: AsyncCallback) : void; - function getCurrentLocation(callback: AsyncCallback) : void; - function getCurrentLocation(request?: CurrentLocationRequest) : Promise; + function getCurrentLocation(request: CurrentLocationRequest, callback: AsyncCallback): void; + function getCurrentLocation(callback: AsyncCallback): void; + function getCurrentLocation(request?: CurrentLocationRequest): Promise; /** * obtain last known location @@ -187,8 +187,8 @@ declare namespace geolocation { * @permission ohos.permission.LOCATION * @param callback Indicates the callback for reporting the location result. */ - function getLastLocation(callback: AsyncCallback) : void; - function getLastLocation() : Promise; + function getLastLocation(callback: AsyncCallback): void; + function getLastLocation(): Promise; /** * obtain current location switch status @@ -198,8 +198,8 @@ declare namespace geolocation { * @permission ohos.permission.LOCATION * @param callback Indicates the callback for reporting the location switch result. */ - function isLocationEnabled(callback: AsyncCallback) : void; - function isLocationEnabled() : Promise; + function isLocationEnabled(callback: AsyncCallback): void; + function isLocationEnabled(): Promise; /** * request enable location @@ -209,8 +209,8 @@ declare namespace geolocation { * @permission ohos.permission.LOCATION * @param callback Indicates the callback for reporting the location switch status. */ - function requestEnableLocation(callback: AsyncCallback) : void; - function requestEnableLocation() : Promise; + function requestEnableLocation(callback: AsyncCallback): void; + function requestEnableLocation(): Promise; /** * enable location switch @@ -221,8 +221,8 @@ declare namespace geolocation { * @permission ohos.permission.MANAGE_SECURE_SETTINGS * @param callback Indicates the callback for reporting the location switch result. */ - function enableLocation(callback: AsyncCallback) : void; - function enableLocation() : Promise; + function enableLocation(callback: AsyncCallback): void; + function enableLocation(): Promise; /** * disable location switch @@ -233,8 +233,8 @@ declare namespace geolocation { * @permission ohos.permission.MANAGE_SECURE_SETTINGS * @param callback Indicates the callback for reporting the location switch result. */ - function disableLocation(callback: AsyncCallback) : void; - function disableLocation() : Promise; + function disableLocation(callback: AsyncCallback): void; + function disableLocation(): Promise; /** * obtain address info from location @@ -244,8 +244,8 @@ declare namespace geolocation { * @permission ohos.permission.LOCATION * @param callback Indicates the callback for reporting the address info. */ - function getAddressesFromLocation(request: ReverseGeoCodeRequest, callback: AsyncCallback>) : void; - function getAddressesFromLocation(request: ReverseGeoCodeRequest) : Promise>; + function getAddressesFromLocation(request: ReverseGeoCodeRequest, callback: AsyncCallback>): void; + function getAddressesFromLocation(request: ReverseGeoCodeRequest): Promise>; /** * obtain latitude and longitude info from location address @@ -255,8 +255,8 @@ declare namespace geolocation { * @permission ohos.permission.LOCATION * @param callback Indicates the callback for reporting the latitude and longitude result. */ - function getAddressesFromLocationName(request: GeoCodeRequest, callback: AsyncCallback>) : void; - function getAddressesFromLocationName(request: GeoCodeRequest) : Promise>; + function getAddressesFromLocationName(request: GeoCodeRequest, callback: AsyncCallback>): void; + function getAddressesFromLocationName(request: GeoCodeRequest): Promise>; /** * obtain geocode service status @@ -266,8 +266,8 @@ declare namespace geolocation { * @permission ohos.permission.LOCATION * @param callback Indicates the callback for reporting the geocode service status. */ - function isGeoServiceAvailable(callback: AsyncCallback) : void; - function isGeoServiceAvailable() : Promise; + function isGeoServiceAvailable(callback: AsyncCallback): void; + function isGeoServiceAvailable(): Promise; /** * obtain the number of cached GNSS locations reported at a time @@ -277,8 +277,8 @@ declare namespace geolocation { * @permission ohos.permission.LOCATION * @param callback Indicates the callback for reporting the cached GNSS locations size. */ - function getCachedGnssLocationsSize(callback: AsyncCallback) : void; - function getCachedGnssLocationsSize() : Promise; + function getCachedGnssLocationsSize(callback: AsyncCallback): void; + function getCachedGnssLocationsSize(): Promise; /** * all prepared GNSS locations are returned to the application through the callback function, @@ -289,8 +289,8 @@ declare namespace geolocation { * @permission ohos.permission.LOCATION * @param callback Indicates the callback for reporting the result. */ - function flushCachedGnssLocations(callback: AsyncCallback) : void; - function flushCachedGnssLocations() : Promise; + function flushCachedGnssLocations(callback: AsyncCallback): void; + function flushCachedGnssLocations(): Promise; /** * send extended commands to location subsystem. @@ -301,8 +301,8 @@ declare namespace geolocation { * @param command Indicates the extended Command Message Body. * @param callback Indicates the callback for reporting the send command result. */ - function sendCommand(command: LocationCommand, callback: AsyncCallback) : void; - function sendCommand(command: LocationCommand) : Promise; + function sendCommand(command: LocationCommand, callback: AsyncCallback): void; + function sendCommand(command: LocationCommand): Promise; /** * obtain the current country code. @@ -311,8 +311,8 @@ declare namespace geolocation { * @syscap SystemCapability.Location.Location.Core * @param callback Indicates the callback for reporting the country code. */ - function getCountryCode(callback: AsyncCallback) : void; - function getCountryCode() : Promise; + function getCountryCode(callback: AsyncCallback): void; + function getCountryCode(): Promise; /** * enable the geographical location simulation function. @@ -325,8 +325,10 @@ declare namespace geolocation { * of enabling the location simulation function. If the enabling fails, the error message will * be carried in the first parameter err of AsyncCallback, If enabling succeeds, no data will be returned. */ - function enableLocationMock(scenario?: LocationRequestScenario, callback: AsyncCallback) : void; - function enableLocationMock(scenario?: LocationRequestScenario) : Promise; + function enableLocationMock(scenario: LocationRequestScenario, callback: AsyncCallback): void; + function enableLocationMock(callback: AsyncCallback): void; + function enableLocationMock(scenario: LocationRequestScenario): Promise; + function enableLocationMock(): Promise; /** * disable the geographical location simulation function. @@ -339,8 +341,10 @@ declare namespace geolocation { * of disabling the location simulation function. If the disabling fails, the error message will * be carried in the first parameter err of AsyncCallback, If disabling succeeds, no data will be returned. */ - function disableLocationMock(scenario?: LocationRequestScenario, callback: AsyncCallback) : void; - function disableLocationMock(scenario?: LocationRequestScenario) : Promise; + function disableLocationMock(scenario: LocationRequestScenario, callback: AsyncCallback): void; + function disableLocationMock(callback: AsyncCallback): void; + function disableLocationMock(scenario: LocationRequestScenario): Promise; + function disableLocationMock(): Promise; /** * set the configuration parameters for location simulation. @@ -353,8 +357,8 @@ declare namespace geolocation { * the simulation locations. If the setting fails, the error message will be carried in the first * parameter err of AsyncCallback. If the setting succeeds, no data will be returned. */ - function setMockedLocations(config: LocationMockConfig, callback: AsyncCallback) : void; - function setMockedLocations(config: LocationMockConfig) : Promise; + function setMockedLocations(config: LocationMockConfig, callback: AsyncCallback): void; + function setMockedLocations(config: LocationMockConfig): Promise; /** * enable the reverse geocoding simulation function. @@ -366,8 +370,8 @@ declare namespace geolocation { * of enabling the reverse geocode simulation function. If the enabling fails, the error message will * be carried in the first parameter err of AsyncCallback, If enabling succeeds, no data will be returned. */ - function enableReverseGeocodingMock(callback: AsyncCallback) : void; - function enableReverseGeocodingMock() : Promise; + function enableReverseGeocodingMock(callback: AsyncCallback): void; + function enableReverseGeocodingMock(): Promise; /** * disable the reverse geocoding simulation function. @@ -379,8 +383,8 @@ declare namespace geolocation { * of disabling the reverse geocode simulation function. If the disabling fails, the error message will * be carried in the first parameter err of AsyncCallback, If disabling succeeds, no data will be returned. */ - function disableReverseGeocodingMock(callback: AsyncCallback) : void; - function disableReverseGeocodingMock() : Promise; + function disableReverseGeocodingMock(callback: AsyncCallback): void; + function disableReverseGeocodingMock(): Promise; /** * set the configuration parameters for simulating reverse geocoding. @@ -394,8 +398,8 @@ declare namespace geolocation { * the error message will be carried in the first parameter err of AsyncCallback. * If the setting succeeds, no data will be returned. */ - function setReverseGeocodingMockInfo(mockInfos: Array, callback: AsyncCallback) : void; - function setReverseGeocodingMockInfo(mockInfos: Array) : Promise; + function setReverseGeocodingMockInfo(mockInfos: Array, callback: AsyncCallback): void; + function setReverseGeocodingMockInfo(mockInfos: Array): Promise; /** * configuration parameters for simulating reverse geocoding. @@ -486,8 +490,8 @@ declare namespace geolocation { * @param type indicates location privacy protocol type. * @param callback indicates the callback for reporting the location privacy protocol confirmation status. */ - function isLocationPrivacyConfirmed(type : LocationPrivacyType, callback: AsyncCallback) : void; - function isLocationPrivacyConfirmed(type : LocationPrivacyType,) : Promise; + function isLocationPrivacyConfirmed(type: LocationPrivacyType, callback: AsyncCallback): void; + function isLocationPrivacyConfirmed(type: LocationPrivacyType,): Promise; /** * set location privacy protocol confirmation status. @@ -500,8 +504,8 @@ declare namespace geolocation { * @param isConfirmed indicates whether the location privacy protocol has been confirmed. * @param callback Indicates the callback for reporting whether the action is set successfully. */ - function setLocationPrivacyConfirmStatus(type : LocationPrivacyType, isConfirmed : boolean, callback: AsyncCallback) : void; - function setLocationPrivacyConfirmStatus(type : LocationPrivacyType, isConfirmed : boolean) : Promise; + function setLocationPrivacyConfirmStatus(type: LocationPrivacyType, isConfirmed: boolean, callback: AsyncCallback): void; + function setLocationPrivacyConfirmStatus(type: LocationPrivacyType, isConfirmed: boolean): Promise; /** * configuring parameters in reverse geocode requests -- Gitee