1.0.7 • Published 6 years ago

check-and-execute v1.0.7

Weekly downloads
11
License
MIT
Repository
github
Last release
6 years ago

Check and Execute by DOM Selector

Execute given functions when a given selector exists inside of the DOM.

Usage

You use the "use" function in order to add a handler to the execution chain:

 import checkAndExecute from 'check-and-execute';

 // accepts Array of selectors or String
 const check = ['.example', '.example-two'];

 function execute () {
   console.log('load me when class .example and .example-two is available');
 }

 checkAndExecute.use(check, execute);

 checkAndExecute();

You can also add all modules you wanna load to the constructor:

import checkAndExecute from 'check-and-execute';

checkAndExecute([
  {
    // Also takes a string
    check: '.example',
    execute () {
      console.log('load me when class .example is available');
    }
  }
]);

MIT License

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago