1
00:00:01,290 --> 00:00:07,140
Just to reiterate, whenever a user calls the show function inside of a code cell, I only want to execute

2
00:00:07,140 --> 00:00:11,850
that call to show inside of this code cell's accompanying preview window.

3
00:00:12,570 --> 00:00:17,790
So a call to show right here should be executed inside of this preview window, but not in the one down

4
00:00:17,790 --> 00:00:18,120
here.

5
00:00:19,050 --> 00:00:20,700
Let's take a look at how we can implement this.

6
00:00:21,810 --> 00:00:25,500
All right, I want to first begin with just a quick reminder of what we are doing inside of our code

7
00:00:25,500 --> 00:00:29,150
cell component, specifically inside of our selecter that we've been working on.

8
00:00:29,600 --> 00:00:31,440
So inside there, I'm showing a diagram.

9
00:00:31,440 --> 00:00:34,620
Just reflect what we were doing for code cell number two right now.

10
00:00:35,870 --> 00:00:41,420
Inside that sector, we first begin by defining that cumulative code array and we stick in the show

11
00:00:41,420 --> 00:00:46,340
function, and inside of that function is a bunch of logic to actually take a value and display it on

12
00:00:46,340 --> 00:00:46,870
the screen.

13
00:00:47,750 --> 00:00:52,130
Then inside of our four loop, we add in all the code for code cell number one and code cell number

14
00:00:52,130 --> 00:00:52,460
two.

15
00:00:53,240 --> 00:00:57,980
Whenever the code from code cell number one or number two try to call the show function, they're both

16
00:00:57,980 --> 00:01:02,570
going to be accessing the show function we had injected at the very start of that array.

17
00:01:03,440 --> 00:01:05,660
So they're both looking at that function right there.

18
00:01:07,770 --> 00:01:12,120
Now, let's take a look at another diagram of what we are going to do to actually implement this new

19
00:01:12,120 --> 00:01:17,070
feature, make sure that any color to show inside a code cell, no one don't actually get processed.

20
00:01:17,910 --> 00:01:18,810
OK, here we go.

21
00:01:20,420 --> 00:01:24,560
So all we're going to do is define multiple copies of the show function.

22
00:01:25,680 --> 00:01:30,300
The very first entry that we're going to add into our array is going to be a copy of the show function

23
00:01:30,300 --> 00:01:32,600
that does absolutely nothing when called.

24
00:01:33,270 --> 00:01:35,490
Well, then add in all the code from code SEAL number one.

25
00:01:36,180 --> 00:01:37,740
And then here's the critical part.

26
00:01:37,920 --> 00:01:40,170
We're going to redefine the show function.

27
00:01:41,450 --> 00:01:45,170
When we redefined the show function, we're going to put a version of the show function that actually

28
00:01:45,170 --> 00:01:49,940
shows some content on the screen, and then immediately after that, we'll add in all the code for Code

29
00:01:49,940 --> 00:01:50,820
Selt number two.

30
00:01:51,530 --> 00:01:56,330
So think about what is going to happen now whenever we execute the bundled result of all this code.

31
00:01:56,990 --> 00:01:59,360
Whenever we execute this, we're going to first define show.

32
00:01:59,390 --> 00:02:01,370
We're going to define a version of it that does nothing.

33
00:02:01,370 --> 00:02:06,290
What it is called will then have all the code from code cell number one if code.

34
00:02:06,290 --> 00:02:10,789
So no one attempts to call show, it's going to call the version that does nothing at all.

35
00:02:12,100 --> 00:02:13,420
We then redefined show.

36
00:02:14,700 --> 00:02:20,760
We then run the code or add in the code for code cell number to be executed and any calls to the show

37
00:02:20,760 --> 00:02:26,910
function for code cell number two are going to go to the redefined working version of the show function.

38
00:02:28,030 --> 00:02:29,200
So this is how we're going to do it.

39
00:02:29,230 --> 00:02:34,720
So now if no one ever calls show, nothing happens if Coatesville number two calls show, we're going

40
00:02:34,720 --> 00:02:38,020
to actually go ahead and take the provided value and displayed on the screen.

41
00:02:38,770 --> 00:02:39,240
That's it.

42
00:02:39,250 --> 00:02:39,880
That's the trick.

43
00:02:40,940 --> 00:02:44,180
Well, let's take a pause right here and then work on the implementation in just a moment.

