Skip to content

Commit 82b62a5

Browse files
authored
Merge pull request #31 from eapearson/master
remove unused functionality, fix channel usage.
2 parents 6b46a89 + 718221e commit 82b62a5

File tree

2 files changed

+4
-84
lines changed

2 files changed

+4
-84
lines changed

src/plugin/iframe_root/modules/lib/integration.js

Lines changed: 2 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -46,57 +46,7 @@ define(['./windowChannel', './runtime'], (WindowChannel, Runtime) => {
4646
return JSON.parse(decodeURIComponent(this.rootWindow.frameElement.getAttribute('data-params')));
4747
}
4848

49-
// render(ko) {
50-
// this.rootViewModel = new RootViewModel({
51-
// runtime: this.runtime,
52-
// hostChannel: this.hostChannel,
53-
// authorized: this.authorized,
54-
// authorization: this.authorization,
55-
// pluginParams: this.pluginParams
56-
// });
57-
// this.container.innerHTML = div(
58-
// {
59-
// style: {
60-
// flex: '1 1 0px',
61-
// display: 'flex',
62-
// flexDirection: 'column'
63-
// }
64-
// // dataBind: {
65-
// // component: {
66-
// // name: MainComponent.quotedName(),
67-
// // params: {
68-
// // runtime: 'runtime',
69-
// // bus: 'bus',
70-
// // authorization: 'authorization',
71-
// // pluginParams: 'pluginParams'
72-
// // }
73-
// // }
74-
// // }
75-
// },
76-
// gen.if(
77-
// 'ready',
78-
// gen.component({
79-
// name: MainComponent.name(),
80-
// params: {
81-
// runtime: 'runtime',
82-
// bus: 'bus',
83-
// authorization: 'authorization',
84-
// pluginParams: 'pluginParams'
85-
// }
86-
// })
87-
// )
88-
// );
89-
// ko.applyBindings(this.rootViewModel, this.container);
90-
// }
91-
92-
showHelp() {
93-
this.rootViewModel.bus.send('help');
94-
}
95-
9649
start() {
97-
// return knockoutLoader.load().then((ko) => {
98-
// ko.options.deferUpdates = true;
99-
// ko.options.createChildContextWithAs = true;
10050
this.channel.start();
10151

10252
this.channel.on('start', (payload) => {
@@ -111,34 +61,7 @@ define(['./windowChannel', './runtime'], (WindowChannel, Runtime) => {
11161
this.config = config;
11262
this.authorized = token ? true : false;
11363

114-
this.runtime = new runtime.Runtime({ config, token, username, realname, email });
115-
// this.render(ko);
116-
117-
this.rootViewModel.bus.on('set-plugin-params', ({ pluginParams }) => {
118-
this.hostChannel.send('set-plugin-params', { pluginParams });
119-
});
120-
121-
this.channel.on('show-help', () => {
122-
this.showHelp();
123-
});
124-
125-
// this.channel.on('loggedin', ({ token, username, realname, email }) => {
126-
// this.runtime.auth({ token, username, realname, email });
127-
// this.rootViewModel.authorized(true);
128-
// this.rootViewModel.authorization({ token, username, realname, email });
129-
// // really faked for now.
130-
// // this.runtime.service('session').
131-
// });
132-
133-
// this.channel.on('loggedout', () => {
134-
// this.runtime.unauth();
135-
// this.rootViewModel.authorized(false);
136-
// this.rootViewModel.authorization(null);
137-
// });
138-
139-
// this.rootViewModel.bus.on('instrumentation', (payload) => {
140-
// this.hostChannel.send('send-instrumentation', payload);
141-
// });
64+
this.runtime = new Runtime({ config, token, username, realname, email });
14265
});
14366

14467
window.document.addEventListener('click', () => {
@@ -151,11 +74,10 @@ define(['./windowChannel', './runtime'], (WindowChannel, Runtime) => {
15174
// on the same channel, with control via the channel id. However, there is a risk
15275
// the the channels will listen on for the same message ... unlikely though.
15376
// Still, it would be odd for one window to listen for messages on another...
154-
this.hostChannel.send('ready', {
77+
this.channel.send('ready', {
15578
channelId: this.channel.id,
15679
channelHost: this.channel.host
15780
});
158-
// });
15981
}
16082

16183
stop() {}

src/plugin/iframe_root/modules/lib/runtime.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ define(['bluebird', 'kb_lib/props', 'kb_lib/messenger', 'lib/widget/manager'], (
55
WidgetManager
66
) => {
77
'use strict';
8-
class Runtime {
8+
return class Runtime {
99
constructor({ token, username, config }) {
1010
this.token = token;
1111
this.username = username;
@@ -82,7 +82,5 @@ define(['bluebird', 'kb_lib/props', 'kb_lib/messenger', 'lib/widget/manager'], (
8282
window.clearInterval(this.heartbeatTimer);
8383
});
8484
}
85-
}
86-
87-
return Runtime;
85+
};
8886
});

0 commit comments

Comments
 (0)