August 2017
Beginner
298 pages
7h 4m
English
In your weather.js file, add the following import statements at the top:
import apiCall from './services/api/apiCall';import './lib/skycons';
The Skycons library will add a global variable, Skycons, to the window object. It is used to show an animated Scalable Vector Graphics (SVG) icon in the canvas element. Currently, all the class variables, such as latitude and longitude, are created in the constructor. But instead, it is better to create them only when the Weather Widget is added to the DOM. Let's move the variables to the connectedCallback() method so that the variables are created only when the widget is added to the DOM. Your Weather class will now look as follows:
class Weather extends ...
Read now
Unlock full access