qcobjects 2.5.113-beta → 2.5.115-beta

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -12,18 +12,6 @@ declare module "ClassFactory" {
12
12
  import { TClassFactory } from "types";
13
13
  export const ClassFactory: TClassFactory;
14
14
  }
15
- declare module "_import_" {
16
- function _import_(name: string): Promise<any>;
17
- export { _import_ };
18
- }
19
- declare module "platform" {
20
- export const isDeno: boolean;
21
- export const isBrowser: boolean;
22
- export const isNodeCommonJS: boolean;
23
- export const deno_require: (name: string) => void;
24
- export const _require_: (name: string) => any;
25
- export const is_phonegap: boolean;
26
- }
27
15
  declare module "Cast" {
28
16
  /**
29
17
  * Casts an object to another object class type
@@ -40,6 +28,18 @@ declare module "Cast" {
40
28
  */
41
29
  export const _CastProps: (obj_source: any, obj_dest: any, _ignoreError?: boolean) => any;
42
30
  }
31
+ declare module "_import_" {
32
+ function _import_(name: string): Promise<any>;
33
+ export { _import_ };
34
+ }
35
+ declare module "platform" {
36
+ export const isDeno: boolean;
37
+ export const isBrowser: boolean;
38
+ export const isNodeCommonJS: boolean;
39
+ export const deno_require: (name: string) => void;
40
+ export const _require_: (name: string) => any;
41
+ export const is_phonegap: boolean;
42
+ }
43
43
  declare module "DOMCreateElement" {
44
44
  import { IQCObjectsElement } from "types";
45
45
  export const _DOMCreateElement: (elementName: string, props?: any[], children?: any) => IQCObjectsElement;
@@ -977,6 +977,7 @@ declare module "Toggle" {
977
977
  }
978
978
  declare module "QCObjects" {
979
979
  export * as AssignPolyfill from "assign";
980
+ export * as __top__ from "top";
980
981
  export { _top, resetTop } from "top";
981
982
  export { _QC_CLASSES, _QC_PACKAGES, _QC_PACKAGES_IMPORTED, _QC_READY_LISTENERS } from "PrimaryCollections";
982
983
  export { _DataStringify } from "DataStringify";
@@ -1,5 +1,5 @@
1
1
  import { IQCObjectsElement, IQCObjectsShadowedElement } from "types";
2
- import { _top } from "./top";
2
+ import { _top, set } from "./top";
3
3
  import { _fireAsyncLoad, asyncLoad } from "./asyncLoad";
4
4
  import { captureFalseTouch } from "./captureFalseTouch";
5
5
  import { _Cast } from "./Cast";
@@ -520,7 +520,14 @@ import { range } from "./range";
520
520
  Class("GLOBAL", (_QC_CLASSES as any).global); // case insensitive for compatibility con old versions;
521
521
  Export(ClassFactory("GLOBAL"));
522
522
  }
523
- Export(global);
523
+
524
+ if (isBrowser && typeof window !== "undefined"){
525
+ set("global", window);
526
+ } else if (typeof global !== "undefined" ){
527
+ set("global", global);
528
+ } else if (typeof globalThis !== "undefined") {
529
+ set("global", globalThis);
530
+ }
524
531
 
525
532
  loadSDK();
526
533
  })(_top);
package/src/QCObjects.ts CHANGED
@@ -32,7 +32,8 @@
32
32
  "use strict";
33
33
 
34
34
  export * as AssignPolyfill from "./assign";
35
- export { _top, resetTop } from "./top";
35
+ export * as __top__ from "./top";
36
+ export {_top, resetTop} from "./top";
36
37
  export { _QC_CLASSES, _QC_PACKAGES, _QC_PACKAGES_IMPORTED, _QC_READY_LISTENERS } from "./PrimaryCollections";
37
38
  export { _DataStringify } from "./DataStringify";
38
39
  export { _DOMCreateElement } from "./DOMCreateElement";
@@ -1,19 +1,17 @@
1
- import { isBrowser } from "./platform";
2
- import { _top } from "./top";
3
-
1
+ import { _top, set } from "./top";
2
+ declare const global:any;
3
+ declare const globalThis:any;
4
4
 
5
5
  export const __make_global__ = function (f:any) {
6
- if (typeof f !== "undefined") {
7
- if (isBrowser) {
8
- try {
9
- (_top as any)[f.name] = f;
10
- window[f.name] = f;
11
- } catch (e:any) { throw Error (`An error ocurred: ${e}`); }
12
- } else if (typeof global !== "undefined") {
13
- if (!Object.hasOwn(global, f.name)) {
14
- (global as any)[f.name] = f;
15
- }
6
+ if (!!f && !!f.name) {
7
+ if (typeof _top !== "undefined" && typeof f !== "undefined" && _top !== null && !Object.hasOwn(_top,f.name)) {
8
+ set(f.name, f);
9
+ } else if (typeof global !== "undefined"){
10
+ global[f.name] = f;
11
+ } else if (typeof globalThis !== "undefined"){
12
+ globalThis[f.name] = f;
16
13
  }
14
+
17
15
  }
18
16
 
19
17
  };
package/src/top.ts CHANGED
@@ -95,7 +95,7 @@ export var _top: QCObjects = (
95
95
  (typeof global !== "undefined" && global) ||
96
96
  (typeof globalThis !== "undefined" && globalThis) ||
97
97
  (typeof window !== "undefined" && window) ||
98
- (typeof self !== "undefined" && self) ||
98
+ (typeof self !== "undefined" && self !== null && self) ||
99
99
  this
100
100
  ) as QCObjects;
101
101
  (_top as any).lastCache = undefined;