Skip to content

Commit aea7fa9

Browse files
fix(core): Remove unneeded Hub.dispatch and Hub.listen (#2919)
Fixes #2623
1 parent 9bfb979 commit aea7fa9

File tree

2 files changed

+1
-30
lines changed

2 files changed

+1
-30
lines changed

packages/aws-amplify-react/src/Storage/S3Album.js

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,13 @@
1414
import * as React from 'react';
1515
import { Component } from 'react';
1616

17-
import { JS, ConsoleLogger as Logger, Hub } from '@aws-amplify/core';
17+
import { JS, ConsoleLogger as Logger } from '@aws-amplify/core';
1818
import Storage from '@aws-amplify/storage';
1919

2020
import Picker from '../Widget/Picker';
2121
import AmplifyTheme from '../AmplifyTheme';
2222
import S3Image from './S3Image';
2323
import S3Text from './S3Text';
24-
import { calcKey } from './Common';
2524

2625
const logger = new Logger('Storage.S3Album');
2726

@@ -34,14 +33,10 @@ export default class S3Album extends Component {
3433
this.list = this.list.bind(this);
3534
this.marshal = this.marshal.bind(this);
3635

37-
const theme = this.props.theme || AmplifyTheme;
3836
this.state = {
39-
theme,
4037
items: [],
4138
ts: new Date().getTime()
4239
};
43-
44-
Hub.listen('window', this, 'S3Album');
4540
}
4641

4742
getKey(file) {
@@ -117,11 +112,6 @@ export default class S3Album extends Component {
117112
onSelect(item, selected_items);
118113
}
119114

120-
onHubCapsule(capsule) {
121-
const theme = this.props.theme || AmplifyTheme;
122-
this.setState({ theme: Object.assign({}, theme) });
123-
}
124-
125115
componentDidMount() {
126116
this.list();
127117
}

packages/core/src/ClientDevice/browser.ts

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -88,22 +88,3 @@ function browserType(userAgent) {
8888

8989
return { type: '', version: '' };
9090
}
91-
92-
if (JS.browserOrNode().isBrowser && typeof window.addEventListener === 'function') {
93-
window.addEventListener('resize', function() {
94-
Hub.dispatch('window', { event: 'resize', data: dimension() }, 'DeviceInfo');
95-
});
96-
97-
window.addEventListener('scroll', function() {
98-
const pos = { x: window.scrollX, y: window.scrollY };
99-
Hub.dispatch('window', { event: 'scroll', data: pos }, 'DeviceInfo');
100-
});
101-
102-
window.addEventListener('offline', function() {
103-
Hub.dispatch('window', { event: 'offline' }, 'DeviceInfor');
104-
});
105-
106-
window.addEventListener('online', function() {
107-
Hub.dispatch('window', { event: 'online' }, 'DeviceInfor');
108-
});
109-
}

0 commit comments

Comments
 (0)