0.0.27 • Published 1 year ago

be-vigilant v0.0.27

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

be-vigilant

Add mutation observer to element.

Playwright Tests NPM version

Size, including be-decorated framework:

How big is this package in your project?

Size of new code:

Use case I: Many UI libraries are built around communicating between elements via events. be-vigilant translates mutation changes into events.

<div be-vigilant=my-event-name>
...
</div>

Event my-event-name is fired from the div element when the direct children of the div element change.

If the value of the attribute isn't specified, the default event name is be-vigilant-changed:

<div be-vigilant>
...
</div>

Use case II: be-vigilant also provides a brute-force way of sniffing out be-decorated adorned elements, even behind nooks and crannies of the DOM. be-decorated behaviors search for elements based on css observing, but sometimes those aren't always picked up.

For example:

<select>
    <template be-repeated></template>
</select>

Using the standard ways be-decorated elements are registered via css animation queries, this template simply won't be registered.

be-vigilant will cause it to register, if instructed to do so:

<select be-vigilant='{
    "forBs": true
}'>
    <template be-repeated></template>
</select>

To fine tune how the mutation observer is configured:

<div be-vigilant='{
    "subtree": true,
    "dispatchInfo": "my-event-name"
}'>
...
</div>

Another option, matchActions, provides the ability to specify different event names, based on css match tests on the mutated elements.

CDN

To use from a CDN:

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

2 years ago

0.0.21

2 years ago

0.0.22

2 years ago

0.0.23

2 years ago

0.0.24

2 years ago

0.0.25

2 years ago

0.0.26

1 year ago

0.0.27

1 year ago

0.0.17

2 years ago

0.0.18

2 years ago

0.0.19

2 years ago

0.0.10

2 years ago

0.0.11

2 years ago

0.0.12

2 years ago

0.0.13

2 years ago

0.0.14

2 years ago

0.0.15

2 years ago

0.0.16

2 years ago

0.0.9

2 years ago

0.0.1

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.8

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.0

3 years ago