1
00:00:00,240 --> 00:00:06,570
It's going to be a quick lesson to avoid any memory leaks, so whenever we're generating that create

2
00:00:06,570 --> 00:00:11,910
object neutral, there's a precaution that we should take and that's to avoid any memory leaks.

3
00:00:12,210 --> 00:00:17,220
So using the file value, we're going to check to see if it already exists.

4
00:00:17,490 --> 00:00:20,280
So I'm going to move this actually as a global variable.

5
00:00:20,700 --> 00:00:26,230
And that way, if we create a second file, we can always check to see if the first one exists.

6
00:00:26,610 --> 00:00:29,610
So let's take a look for that before we generate our.

7
00:00:30,910 --> 00:00:38,920
Create object euro and we're going to check to see if file is not equal to null.

8
00:00:39,130 --> 00:00:45,310
So basically, if there is a value for file, then what we want to do is we want to use that window

9
00:00:45,520 --> 00:00:50,660
object you, Earl, and revoke object you URL.

10
00:00:51,070 --> 00:00:56,680
So basically it releases an existing object, your URL that might be there and we're going to revoke

11
00:00:56,680 --> 00:00:57,650
it as file.

12
00:00:58,210 --> 00:01:03,280
So that will give us the ability when we do want to create the new one that we're removing that existing

13
00:01:03,280 --> 00:01:03,550
one.

14
00:01:04,820 --> 00:01:09,890
And we're actually going to place that on neutral instead of file so that you are all needs to be the

15
00:01:09,890 --> 00:01:13,130
one that's the global object, not the file.

16
00:01:13,370 --> 00:01:16,190
So we're checking to see if the Eurail is there.

17
00:01:16,730 --> 00:01:24,470
And if it is, then we're releasing the URL and otherwise we're going to set the URL and then this one

18
00:01:24,470 --> 00:01:26,960
can still have the file within the CSFI.

19
00:01:27,230 --> 00:01:28,310
So within that scope.

20
00:01:29,480 --> 00:01:36,110
There's a URL and this is the revoking of the URL, checking to see if it's available globally and this

21
00:01:36,110 --> 00:01:43,300
is obviously a URL is a window object, so you can include the window as well to make it more exact.

22
00:01:43,300 --> 00:01:44,200
And I'll work the same way.

23
00:01:44,210 --> 00:01:45,100
So let's try that out.

24
00:01:45,410 --> 00:01:51,410
So now when we create the file and we can create another file, we can create another one because it's

25
00:01:51,410 --> 00:01:55,840
constantly releasing the existing one, whereas before if we clicked it, we would only have the one.

26
00:01:56,510 --> 00:01:57,500
So it's a quick fix.

27
00:01:57,500 --> 00:02:01,040
And coming up next, we're going to go back into creating the CSV file.
