Skip to content

Commit 57accfb

Browse files
committed
chore(*): replace setImmediate and remove core-js-pure
1 parent a858f05 commit 57accfb

File tree

6 files changed

+73
-8
lines changed

6 files changed

+73
-8
lines changed

LICENSE

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ This is a commercial product, requiring a valid paid-for license for commercial
22
This product is free to use for non-commercial educational use for students in K through 12 grades
33
or University programs, and for educators to use in a classroom setting as examples / tools in their curriculum.
44

5+
This repository includes files originally copied from https://github.com/zloirock/core-js
6+
under setImmediate.ts. The original versions of the files are MIT licensed. See the file headers for details.
7+
58
In order for us to verify your eligibility for free usage, please register for trial at
69
https://Infragistics.com/Angular and open a support ticket with a request for free license.
710

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/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",
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
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+
export function setImmediate(cb: any) {
40+
if (window.setImmediate) {
41+
window.setImmediate(cb);
42+
return;
43+
}
44+
45+
const args = [];
46+
let i = 1;
47+
48+
while (arguments.length > i) {
49+
args.push(arguments[i++]);
50+
}
51+
52+
queue[++counter] = function () {
53+
(typeof cb === 'function' ? cb : Function(cb)).apply(undefined, args);
54+
};
55+
56+
window.postMessage(counter + '', windowLocation.protocol + '//' + windowLocation.host);
57+
window.addEventListener('message', listener, false);
58+
59+
return counter;
60+
}
61+
62+
export function clearImmediate(id: any) {
63+
if (window.clearImmediate) {
64+
window.clearImmediate(id);
65+
return;
66+
}
67+
68+
delete queue[id];
69+
}

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
import merge from 'lodash.merge';
77

88
/**

0 commit comments

Comments
 (0)