1.2.5 • Published 2 years ago

init-with-dom v1.2.5

Weekly downloads
2
License
MIT
Repository
github
Last release
2 years ago

IWD (init with DOM) NPM version

About

This script performs the function with the name specified in the attribute of the dom element in the context of this item.

Supported the start of the function even if the DOM Element has been added after initialization of the script (MutationObserver).

Browser

  • IE 10+
  • Edge
  • Firefox 14+
  • Chrome 18+
  • Safary 6+
  • Opera 15+
  • iOS Safari 6.1+
  • Android Browser 4.4 +

Usage

<div data-js="time" data-name="Hi" id="megaId"></div>
<script>
  function time (params) {
    var self = this; // DOM Element <div data-js="time"></div>
    var seconds;

    params; // { data: { name: "Hi" }, class: "js", id: "megaId" }

    setInterval(function () {
      var dt = new Date();

      if (seconds !== dt.getSeconds()) {
        self.innerText = dt.getHours() + ':' + dt.getMinutes() + ':' + dt.getSeconds();
      }
      seconds = dt.getSeconds();
    }, 100)
  }
</script>
<script src="../build/iwd.min.js"></script>

Test

Thank you to BrowserStack for providing the infrastructure that allows to test in real browsers.

Test

License

MIT © antitim

1.2.5

2 years ago

1.2.4

4 years ago

1.2.3

5 years ago

1.2.2

6 years ago

1.2.1

6 years ago

1.2.0

6 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago