Skip to content

Commit 264a4ed

Browse files
committed
moving config to passed-in locker
1 parent a1e96b9 commit 264a4ed

File tree

2 files changed

+13
-16
lines changed

2 files changed

+13
-16
lines changed

demo/locker.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,6 @@ const locker = {
6868
switch(val) {
6969
case "zones":
7070
window.mi.zones = window.mi.zones || {};
71-
72-
// Demo configs
73-
window.mi.zones.config = {
74-
homepage: "/config/homepage.json",
75-
section: "/config/section.json",
76-
story: "/config/story.json"
77-
}
78-
7971
return window.mi.zones;
8072
case "analytics":
8173
return {
@@ -90,6 +82,13 @@ const locker = {
9082

9183
areAdsAllowed() {
9284
return true;
85+
},
86+
87+
// Demo only for now
88+
config: {
89+
homepage: "/config/homepage.json",
90+
section: "/config/section.json",
91+
story: "/config/story.json"
9392
}
9493
}
9594

index.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,29 +7,27 @@ import * as config from "./lib/config.js";
77
import * as story from "./lib/story.js";
88

99
function distributeZones(locker) {
10-
const zl = locker.getYozonsLocker("zones");
11-
1210
// Setup
1311
zones.setLocker(locker);
1412

1513
// Configs
16-
if(!zl.config) {
17-
zl.config = {
14+
if(!locker.config) {
15+
locker.config = {
1816
homepage: "/static/hi/zones/homepage.json",
1917
section: "/static/hi/zones/section.json",
2018
story: "/static/hi/zones/story.json"
2119
}
2220
}
2321

2422
// Add the communication bridge
25-
zl.changes = zones.changes;
23+
locker.getYozonsLocker("zones").changes = zones.changes;
2624

2725
// Give the performance team a promise
2826
return new Promise((resolve, reject) => {
2927
locker.executeWhenDOMReady(async () => {
3028
switch(locker.pageType) {
3129
case "story":
32-
await config.load(zl.config.story);
30+
await config.load(locker.config.story);
3331

3432
// Change the cadence
3533
const subscriber = locker.user.isSubscriber();
@@ -40,10 +38,10 @@ function distributeZones(locker) {
4038
story.cleanup();
4139
break;
4240
case "homepage":
43-
await config.load(zl.config.homepage);
41+
await config.load(locker.config.homepage);
4442
break;
4543
case "sectfront":
46-
await config.load(zl.config.section);
44+
await config.load(locker.config.section);
4745
break;
4846
default:
4947
reject("not a matching page type");

0 commit comments

Comments
 (0)