Skip to content

Commit e3f48a4

Browse files
committed
move polyfills into modules
1 parent 506649e commit e3f48a4

File tree

7 files changed

+32
-4
lines changed

7 files changed

+32
-4
lines changed

lib/main.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"use strict";
22
var render_1 = require('./components/render');
33
var root_1 = require('./components/root');
4-
var polyfills_1 = require('./polyfills');
4+
var polyfills_1 = require('./modules/polyfills');
55
var subscriptions_1 = require('./subscriptions');
66
var store_1 = require('./store');
77
var actions_1 = require('./modules/setup/actions');

lib/modules/polyfills/index.js

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
"use strict";
2+
var object_values_1 = require('./object-values');
3+
function loadPolyfills() {
4+
object_values_1.default();
5+
}
6+
Object.defineProperty(exports, "__esModule", { value: true });
7+
exports.default = loadPolyfills;
+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
"use strict";
2+
function polyfillObjectValues() {
3+
if (typeof Object.values !== 'function') {
4+
Object.values = function (obj) {
5+
var vals = [];
6+
for (var key in obj) {
7+
vals.push(obj[key]);
8+
}
9+
return vals;
10+
};
11+
}
12+
}
13+
Object.defineProperty(exports, "__esModule", { value: true });
14+
exports.default = polyfillObjectValues;
15+
;

src/main.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as React from 'react';
22
import render from './components/render';
33
import Root from './components/root';
4-
import loadPolyfills from './polyfills';
4+
import loadPolyfills from './modules/polyfills';
55
import {onActivate, onDeactivate, addToStatusBar} from './subscriptions';
66
// activate Redux
77
import store from './store';

src/modules/polyfills/index.ts

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import polyfillObjectValues from './object-values';
2+
3+
export default function loadPolyfills(): void {
4+
polyfillObjectValues();
5+
}

src/polyfills.ts renamed to src/modules/polyfills/object-values.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export default function loadPolyfills(): void {
1+
export default function polyfillObjectValues(): void {
22

33
// Object.values (ES7)
44
if (typeof Object.values !== 'function') {

tsconfig.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@
9090
"src/modules/page/task-tests/index.ts",
9191
"src/modules/page/tasks/index.ts",
9292
"src/modules/page/types.ts",
93+
"src/modules/polyfills/index.ts",
94+
"src/modules/polyfills/object-values.ts",
9395
"src/modules/progress/actions.ts",
9496
"src/modules/progress/index.ts",
9597
"src/modules/progress/reducer.ts",
@@ -136,7 +138,6 @@
136138
"src/modules/window/index.ts",
137139
"src/modules/window/reducer.ts",
138140
"src/modules/window/types.ts",
139-
"src/polyfills.ts",
140141
"src/reducers.ts",
141142
"src/store.ts",
142143
"src/subscriptions.ts",

0 commit comments

Comments
 (0)