0.0.130 • Published 10 months ago

be-exportable v0.0.130

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

be-exportable (📦)

Playwright Tests NPM version How big is this package in your project?

Inline scripts

Make exports from inside a script tag accessible from the DOM.

<script nomodule be-exportable>
    export const foo = 'bar';
</script>

The script tag ends up with a custom field: oScript.beEnhanced.beExportable.exports that exposes each of the export const's.

To wait for the script to load:

const {emc} = await import('be-exportable/behivior.js);
const enhancement = await oScript.beEnhanced.whenResolved(emc);
const {foo} = enhancement.exports;

Inline scripts can reference the script tag with the keyword "selfish".

Inline scripts are quite limited in the syntax. Only "export const blah"'s are exported.

If used repeatedly in a casual setting, you can reference 📦.js and then replace be-exportable with 📦:

<script nomodule 📦>
    export const foo = 'bar';
</script>

External scripts

External scripts are far more flexible, but cannot reference the script tag with the keyword "selfish".

<script nomodule src="blah/blah.js" be-exportable>
</script>

Repeating script tag

If the adorned script tag is inside a template / shadowDOM realm that is repeated throughout the page, the script tag can share the same export constants by setting the id to something starting with "shared-". To be extra safe, use a guid after the shared- prefix.

Integration with blow-dry

If using this enhancement with xtal-element, to avoid the repeated and parsing of script issue, add attribute blow-dry to the script element:

<script blow-dry nomodule be-exportable>
    export const greeting = 'hello';
</script>

Viewing Locally

  1. Install git.
  2. Fork/clone this repo.
  3. Install node.
  4. Open command window to folder where you cloned this repo.
  5. npm install

  6. npm run serve

  7. Open http://localhost:3030/demo/ in a modern browser.

Importing in ES Modules:

import 'be-exportable/be-exportable.js';

Using from CDN:

<script type=module crossorigin=anonymous>
    import 'https://esm.run/be-exportable';
</script>
0.0.128

10 months ago

0.0.129

10 months ago

0.0.130

10 months ago

0.0.127

11 months ago

0.0.126

11 months ago

0.0.125

12 months ago

0.0.124

12 months ago

0.0.117

1 year ago

0.0.116

1 year ago

0.0.115

1 year ago

0.0.119

1 year ago

0.0.118

1 year ago

0.0.120

12 months ago

0.0.123

12 months ago

0.0.122

12 months ago

0.0.121

12 months ago

0.0.114

1 year ago

0.0.113

1 year ago

0.0.112

1 year ago

0.0.111

1 year ago

0.0.109

1 year ago

0.0.110

1 year ago

0.0.106

1 year ago

0.0.108

1 year ago

0.0.107

1 year ago

0.0.105

1 year ago

0.0.104

1 year ago

0.0.103

1 year ago

0.0.102

1 year ago

0.0.101

1 year ago

0.0.100

1 year ago

0.0.99

1 year ago

0.0.98

1 year ago

0.0.97

1 year ago

0.0.85

2 years ago

0.0.86

2 years ago

0.0.87

2 years ago

0.0.88

2 years ago

0.0.89

2 years ago

0.0.95

2 years ago

0.0.96

2 years ago

0.0.90

2 years ago

0.0.92

2 years ago

0.0.93

2 years ago

0.0.94

2 years ago

0.0.84

2 years ago

0.0.82

2 years ago

0.0.83

2 years ago

0.0.80

2 years ago

0.0.81

2 years ago

0.0.75

2 years ago

0.0.76

2 years ago

0.0.77

2 years ago

0.0.78

2 years ago

0.0.79

2 years ago

0.0.73

2 years ago

0.0.74

2 years ago

0.0.71

2 years ago

0.0.72

2 years ago

0.0.70

2 years ago

0.0.69

2 years ago

0.0.68

2 years ago

0.0.63

2 years ago

0.0.64

2 years ago

0.0.65

2 years ago

0.0.66

2 years ago

0.0.67

2 years ago

0.0.62

2 years ago

0.0.60

2 years ago

0.0.61

2 years ago

0.0.59

2 years ago

0.0.51

3 years ago

0.0.52

3 years ago

0.0.53

3 years ago

0.0.54

3 years ago

0.0.55

3 years ago

0.0.56

3 years ago

0.0.57

3 years ago

0.0.58

3 years ago

0.0.40

3 years ago

0.0.41

3 years ago

0.0.42

3 years ago

0.0.43

3 years ago

0.0.44

3 years ago

0.0.45

3 years ago

0.0.46

3 years ago

0.0.47

3 years ago

0.0.38

3 years ago

0.0.39

3 years ago

0.0.50

3 years ago

0.0.48

3 years ago

0.0.49

3 years ago

0.0.37

3 years ago

0.0.30

3 years ago

0.0.31

3 years ago

0.0.32

3 years ago

0.0.33

3 years ago

0.0.34

3 years ago

0.0.35

3 years ago

0.0.36

3 years ago

0.0.29

3 years ago

0.0.22

3 years ago

0.0.23

3 years ago

0.0.24

3 years ago

0.0.25

3 years ago

0.0.26

3 years ago

0.0.27

3 years ago

0.0.28

3 years ago

0.0.20

3 years ago

0.0.21

3 years ago

0.0.15

3 years ago

0.0.16

3 years ago

0.0.17

3 years ago

0.0.18

3 years ago

0.0.19

3 years ago

0.0.10

3 years ago

0.0.11

3 years ago

0.0.12

3 years ago

0.0.13

3 years ago

0.0.14

3 years ago

0.0.3

4 years ago

0.0.9

3 years ago

0.0.8

3 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.7

3 years ago

0.0.6

3 years ago

0.0.1

4 years ago

0.0.2

4 years ago

0.0.0

4 years ago