Skip to content

Commit 201e3e5

Browse files
authored
Add globalThis-preserving Import Path (#875)
1 parent 2af39fa commit 201e3e5

File tree

2 files changed

+31
-21
lines changed

2 files changed

+31
-21
lines changed

src/RosLib.js

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,8 @@
44
*/
55

66
/** @description Library version */
7-
export const REVISION = '1.4.1';
8-
export * from './core/index.js';
9-
export * from './actionlib/index.js';
10-
export * from './math/index.js';
11-
export * from './tf/index.js';
12-
export * from './urdf/index.js';
7+
export * from './index.js';
8+
import ROSLIB from './index.js';
139

14-
import * as Core from './core/index.js';
15-
import * as ActionLib from './actionlib/index.js';
16-
import * as Math from './math/index.js';
17-
import * as Tf from './tf/index.js';
18-
import * as Urdf from './urdf/index.js';
19-
20-
// Add to global namespace for in-browser support (i.e. CDN)
21-
globalThis.ROSLIB = {
22-
REVISION,
23-
...Core,
24-
...ActionLib,
25-
...Math,
26-
...Tf,
27-
...Urdf
28-
};
10+
// same as index.js, except add to global namespace for in-browser support (i.e. CDN)
11+
globalThis.ROSLIB = ROSLIB;

src/index.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/**
2+
* @fileOverview
3+
* @author Russell Toris - [email protected]
4+
*/
5+
6+
/** @description Library version */
7+
export const REVISION = '1.4.1';
8+
export * from './core/index.js';
9+
export * from './actionlib/index.js';
10+
export * from './math/index.js';
11+
export * from './tf/index.js';
12+
export * from './urdf/index.js';
13+
14+
import * as Core from './core/index.js';
15+
import * as ActionLib from './actionlib/index.js';
16+
import * as Math from './math/index.js';
17+
import * as Tf from './tf/index.js';
18+
import * as Urdf from './urdf/index.js';
19+
20+
export default {
21+
REVISION,
22+
...Core,
23+
...ActionLib,
24+
...Math,
25+
...Tf,
26+
...Urdf
27+
};

0 commit comments

Comments
 (0)