Menu
Content Services

Premium Spray Outlook Widget

Daily and hourly spray outlook for identifying spray windows.

Installation

script

Example

                              window.dtn.sprayOutlook.createPremiumSprayOutlookWidget({
 


                                
});
                              
                            

Types

Units

type Units = "Imperial" | "Metric";

These are the available metric sistems that widget support.

Coordinates

type Coordinates = { latitude: number, longitude: number };

This type describe coordinates data that may be used to supply the defaultLocation property.

PostalCode

type PostalCode = { postalCode: string };

This type describe postal code data that may be used to supply the defaultLocation property.

StationId

type StationId = string;

This type describe station id data that may be used to supply the defaultLocation property.

Station

type Station = { id: StationId, displayName: string };

This type describe station data that is needed in stations array property.

Location

type Location = Coordinates | PostalCode | { readonly stationId: StationId };

This type describe location that may be used to supply the defaultLocation property.

SprayOutlookThresholds

type SprayOutlookThresholds = {
    temperatureInversionRisk?: boolean = true;
    daytimeOnlyApplication?: boolean = false;
    rainfreeForecastPeriod?: boolean | number = 10;
    minimumSprayWindow?: number = 3;
    windThresholdUpperLimit?: boolean | number = NaN;
    windThresholdLowerLimit?: boolean | number = NaN;
    temperatureUpperLimit?: boolean | number = NaN;
    temperatureLowerLimit?: boolean | number = NaN;
};

This type describe Spray Outlook Thresholds that may be used to supply setLocation or setThresholds methods.

Configuration

apiKey

apiKey: string;

The widget access api key associated with your DTN account.

container

container: HTMLElement | string;

The container to mount the widget on. This can be a reference to an HTML element, or a valid selector string. If a string is encountered, document.querySelector will be used to search document for the container.

units

units?: Units = "Imperial";

The measuring units that are used for presenting numbers in the weather forecast.

userId

userId: string;

User name in format: "firstName.lastName".

defaultLocation

defaultLocation?: Location;

If { postalCode: "postal code value" } object is passed in the configurations, the widget will be default populated with the data fetched by the specified postal code. If { latitude: "latitude coordinates value", longitude: "longitude coordinates value"} object is passed in the configurations, the widget will be default populated with the data fetched by the specified latitude and longitude.

stations

stations?: Station[];

The list with stations that is going to be listed in the locations dropdown.

showStationsSelect

showStationsSelect?: boolean;

Whether the station select dropdown to be shown. Default set to true.

showPostalCodeInput

showPostalCodeInput?: boolean;

Whether the zip/postal code picker to be shown. Default set to true.

showHourly

showHourly?: "EXPANDED" | boolean = true;

Whether the hourly spray outlook details should be hidden (false), visible (true) or opened ("EXPANDED").

defaultThresholds

defaultThresholds?: SprayOutlookThresholds;

The default thresholds settings used for displaying the widget.

Methods

setLocation

setLocation: (
  location: Location, thresholds?: SprayOutlookThresholds
) => void;

Set the location for the spray outlook.

setThresholds

setThresholds: (thresholds?: SprayOutlookThresholds) => void;

Set the thresholds for the spray outlook.

Callbacks

onPostalCodeChange

onPostalCodeChange: (
  newPostalCode: PostalCode & Coordinates
) => void;

This callback will be called whenever the Postal Code or Coordinates change.

onOutlookChange

onOutlookChange: (
  nextRecommendedSprayTime: Date | undefined,
  thresholds: SprayOutlookThreshold
) => void;

This callback will be called whenever the Outlook data changes.