dom_tools 2.3.2 copy "dom_tools: ^2.3.2" to clipboard
dom_tools: ^2.3.2 copied to clipboard

Platformweb

DOM rich elements and tools for CSS, JavaScript, Element Tracking, DOM Manipulation, Storage, Dialog and more.

example/example.dart

import 'dart:html';

import 'package:dom_tools/dom_tools.dart';

void main() {
  var imgSrc =
      'https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_92x30dp.png';

  // Example of an image that only loads when visualized in viewport:

  var tracker = TrackElementInViewport();
  var imageElement = ImageElement();

  tracker.track(imageElement, onEnterViewport: (elem) {
    // ignore: unsafe_html
    imageElement.src = imgSrc;
  });

  document.body!.children.add(imageElement);

  Future.delayed(Duration(seconds: 10), () {
    var img = getElementBySRC('img', imgSrc);
    if (img == null) {
      window.alert('After 10s the image is not visible in viewport yet');
    } else {
      window.alert('After 10s the image was visible in viewport.');
    }
  });
}
3
likes
140
points
3.69k
downloads

Publisher

unverified uploader

Weekly Downloads

DOM rich elements and tools for CSS, JavaScript, Element Tracking, DOM Manipulation, Storage, Dialog and more.

Repository (GitHub)

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

async_extension, collection, enum_to_string, intl, json_object_mapper, markdown, swiss_knife

More

Packages that depend on dom_tools