Skip to content

Commit 4b83583

Browse files
Merge pull request #7913 from IgniteUI/ibarakov/fix-7808-10.0.x
Replace setImmediate and remove core-js-pure
2 parents 2424d88 + 3211b7d commit 4b83583

File tree

9 files changed

+74
-11
lines changed

9 files changed

+74
-11
lines changed

LICENSE

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ https://Infragistics.com/Angular and open a support ticket with a request for fr
88
To acquire a license for commercial usage, please register for trial at https://Infragistics.com/Angular
99
and refer to the purchasing options in the pricing section on the product page.
1010

11+
This repository includes code originally copied from https://github.com/zloirock/core-js
12+
in the projects/igniteui-angular/src/lib/core/setImmediate.ts file. The original version of the code is MIT licensed. See the file header for details.
13+
1114
© Copyright 2020 INFRAGISTICS. All Rights Reserved.
1215
The Infragistics Ultimate license & copyright applies to this distribution.
1316
For information on that license, please go to our website https://www.infragistics.com/legal/license.

package-lock.json

Lines changed: 0 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@
5656
"@types/source-map": "0.5.2",
5757
"classlist.js": "^1.1.20150312",
5858
"core-js": "^2.6.11",
59-
"core-js-pure": "^3.6.5",
6059
"hammerjs": "^2.0.8",
6160
"igniteui-trial-watermark": "^1.0.3",
6261
"jszip": "^3.5.0",

projects/igniteui-angular/ng-package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
},
88
"whitelistedNonPeerDependencies": [
99
"@types/hammerjs",
10-
"core-js-pure",
1110
"hammerjs",
1211
"jszip",
1312
"resize-observer-polyfill",

projects/igniteui-angular/ng-package.prod.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
},
1010
"whitelistedNonPeerDependencies": [
1111
"@types/hammerjs",
12-
"core-js-pure",
1312
"hammerjs",
1413
"jszip",
1514
"resize-observer-polyfill",

projects/igniteui-angular/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@
6767
],
6868
"dependencies": {
6969
"@types/hammerjs": "^2.0.36",
70-
"core-js-pure": "^3.6.5",
7170
"hammerjs": "^2.0.8",
7271
"jszip": "^3.5.0",
7372
"tslib": "^2.0.0",

projects/igniteui-angular/schematics/utils/dependency-handler.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ export const DEPENDENCIES_MAP: PackageEntry[] = [
2929
{ name: 'resize-observer-polyfill', target: PackageTarget.REGULAR },
3030
{ name: '@types/hammerjs', target: PackageTarget.DEV },
3131
{ name: 'igniteui-trial-watermark', target: PackageTarget.NONE },
32-
{ name: 'core-js-pure', target: PackageTarget.NONE },
3332
// peerDependencies
3433
{ name: '@angular/forms', target: PackageTarget.NONE },
3534
{ name: '@angular/common', target: PackageTarget.NONE },
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
/* Copyright (c) 2014-2020 Denis Pushkarev
2+
*
3+
* Permission is hereby granted, free of charge, to any person obtaining a copy
4+
* of this software and associated documentation files (the "Software"), to deal
5+
* in the Software without restriction, including without limitation the rights
6+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
* copies of the Software, and to permit persons to whom the Software is
8+
* furnished to do so, subject to the following conditions:
9+
*
10+
* The above copyright notice and this permission notice shall be included in
11+
* all copies or substantial portions of the Software.
12+
*
13+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19+
* THE SOFTWARE
20+
*/
21+
22+
// Note: Originally copied from core-js-pure package and modified. (https://github.com/zloirock/core-js)
23+
const windowLocation = window.location;
24+
let counter = 0;
25+
const queue = {};
26+
27+
const run = function (id) {
28+
if (queue.hasOwnProperty(id)) {
29+
const fn = queue[id];
30+
delete queue[id];
31+
fn();
32+
}
33+
};
34+
35+
const listener = function (event) {
36+
run(event.data);
37+
};
38+
39+
if (!window.setImmediate) {
40+
window.addEventListener('message', listener, false);
41+
}
42+
43+
export function setImmediate(cb: any) {
44+
if (window.setImmediate) {
45+
return window.setImmediate(cb);
46+
}
47+
48+
const args = [];
49+
let i = 1;
50+
51+
while (arguments.length > i) {
52+
args.push(arguments[i++]);
53+
}
54+
55+
queue[++counter] = function () {
56+
(typeof cb === 'function' ? cb : Function(cb)).apply(undefined, args);
57+
};
58+
59+
window.postMessage(counter + '', windowLocation.protocol + '//' + windowLocation.host);
60+
61+
return counter;
62+
}
63+
64+
export function clearImmediate(id: any) {
65+
if (window.clearImmediate) {
66+
return window.clearImmediate(id);
67+
}
68+
69+
delete queue[id];
70+
}

projects/igniteui-angular/src/lib/core/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { Injectable, PLATFORM_ID, Inject } from '@angular/core';
22
import { isPlatformBrowser } from '@angular/common';
33
import { Observable } from 'rxjs';
44
import ResizeObserver from 'resize-observer-polyfill';
5-
import { setImmediate } from 'core-js-pure';
5+
import { setImmediate } from './setImmediate';
66

77
/**
88
* @hidden

0 commit comments

Comments
 (0)