highsource / highsource/jsonix
sourceIsEvt is not defined - when used with TypeScript and target ES6
- Dominant language
- JavaScript
- Stars
- 369
- Forks
- 85
- PR merge metrics
- No merged PRs in 30d
Description
Hello,
i'm trying to use jsonix in an Angular 8 application, wenn setting the TypeScript target to ES6/ES2015 there is an ReferenceError because 'sourceIsEvt' was not declared before it is used.
```
jsonix.js:34 Uncaught ReferenceError: sourceIsEvt is not defined
at Object.Jsonix.Util.extend (jsonix.js:34)
...
```
which is pointing to [nodejs/scripts/jsonix.js](https://github.com/highsource/jsonix/blob/fcddd4a4142ee53c737b83482d983eb635b69814/nodejs/scripts/jsonix.js#L34)
and i think the same in [scripts/src/main/javascript/org/hisrc/jsonix/Jsonix/Util.js](https://github.com/highsource/jsonix/blob/22b8800aa5acb645d614d01b858d0c8a25a3075f/scripts/src/main/javascript/org/hisrc/jsonix/Jsonix/Util.js#L28)
---
I don't see any [further usage](https://github.com/highsource/jsonix/search?q=sourceIsEvt&unscoped_q=sourceIsEvt) of this variable in the code so is it possible to declare it with 'var' or is there any reason why this variable should by global?
And if it should be global then maybe it could be declared like this:
```
var windowIsDefined = typeof window !== 'undefined' && window !== null;
if (windowIsDefined) {
window.sourceIsEvt = typeof window.Event === "function" && source instanceof window.Event;
if (!window.sourceIsEvt && source.hasOwnProperty && source.hasOwnProperty('toString')) {
destination.toString = source.toString;
}
}
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.