openvidu-testapp: improved JSON stringify without circular dependencies

pull/621/head
pabloFuente 2021-03-24 12:32:26 +01:00
parent bd83a1993b
commit 928514d57c
3 changed files with 22103 additions and 15536 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,48 +1,49 @@
{
"dependencies": {
"@angular/animations": "8.2.14",
"@angular/cdk": "8.2.3",
"@angular/common": "8.2.14",
"@angular/compiler": "8.2.14",
"@angular/core": "8.2.14",
"@angular/flex-layout": "8.0.0-beta.27",
"@angular/forms": "8.2.14",
"@angular/http": "7.2.15",
"@angular/material": "8.2.3",
"@angular/platform-browser": "8.2.14",
"@angular/platform-browser-dynamic": "8.2.14",
"@angular/router": "8.2.14",
"colormap": "2.3.1",
"core-js": "3.4.7",
"hammerjs": "2.0.8",
"openvidu-browser": "2.17.0",
"openvidu-node-client": "2.17.0",
"rxjs": "6.5.3",
"zone.js": "0.10.2"
},
"devDependencies": {
"@angular-devkit/build-angular": "0.803.20",
"@angular/cli": "8.3.20",
"@angular/compiler-cli": "8.2.14",
"@angular/language-service": "8.2.14",
"@types/jasmine": "3.5.0",
"@types/jasminewd2": "2.0.8",
"@types/node": "12.12.14",
"codelyzer": "5.2.0",
"ts-node": "8.5.4",
"tslint": "5.20.1",
"typescript": "3.5.3"
},
"license": "Apache-2.0",
"name": "openvidu-testapp",
"private": true,
"scripts": {
"build": "ng build",
"e2e": "ng e2e",
"lint": "ng lint",
"ng": "ng",
"start": "ng serve",
"test": "ng test"
},
"version": "2.17.0"
}
"dependencies": {
"@angular/animations": "8.2.14",
"@angular/cdk": "8.2.3",
"@angular/common": "8.2.14",
"@angular/compiler": "8.2.14",
"@angular/core": "8.2.14",
"@angular/flex-layout": "8.0.0-beta.27",
"@angular/forms": "8.2.14",
"@angular/http": "7.2.15",
"@angular/material": "8.2.3",
"@angular/platform-browser": "8.2.14",
"@angular/platform-browser-dynamic": "8.2.14",
"@angular/router": "8.2.14",
"colormap": "2.3.1",
"core-js": "3.4.7",
"hammerjs": "2.0.8",
"json-stringify-safe": "^5.0.1",
"openvidu-browser": "2.17.0",
"openvidu-node-client": "2.17.0",
"rxjs": "6.5.3",
"zone.js": "0.10.2"
},
"devDependencies": {
"@angular-devkit/build-angular": "0.803.20",
"@angular/cli": "8.3.20",
"@angular/compiler-cli": "8.2.14",
"@angular/language-service": "8.2.14",
"@types/jasmine": "3.5.0",
"@types/jasminewd2": "2.0.8",
"@types/node": "12.12.14",
"codelyzer": "5.2.0",
"ts-node": "8.5.4",
"tslint": "5.20.1",
"typescript": "3.5.3"
},
"license": "Apache-2.0",
"name": "openvidu-testapp",
"private": true,
"scripts": {
"build": "ng build",
"e2e": "ng e2e",
"lint": "ng lint",
"ng": "ng",
"start": "ng serve",
"test": "ng test"
},
"version": "2.17.0"
}

View File

@ -4,6 +4,8 @@ import { OpenviduParamsService } from '../../services/openvidu-params.service';
import { TestFeedService } from '../../services/test-feed.service';
import { SessionConf } from '../openvidu-instance/openvidu-instance.component';
var stringify = require('json-stringify-safe');
@Component({
selector: 'app-test-sessions',
templateUrl: './test-sessions.component.html',
@ -101,25 +103,12 @@ export class TestSessionsComponent implements OnInit, OnDestroy {
}
stringifyEventNoCircularDependencies(event: Event): string {
const cache = [];
return JSON.stringify(event, function (key, value) {
if (key !== 'ee' && key !== 'openvidu') {
if (typeof value === 'object' && value !== null) {
if (cache.indexOf(value) !== -1) {
// Duplicate reference found
try {
// If this value does not reference a parent
return JSON.parse(JSON.stringify(value));
} catch (error) {
return;
}
}
// Store value in our collection
cache.push(value);
}
return value;
return stringify(event, (key, value) => {
// Remove unnecessary properties
if (key == 'ee' || key == 'openvidu' || key == 'userHandlerArrowHandler' || key == 'handlers') {
return
} else {
return;
return value;
}
});
}