get-instance-bounding-client-rect.js 429 B

12345678910111213141516
  1. export function getInstanceBoundingClientRect(instance, selector) {
  2. return new Promise(function (resolve) {
  3. instance
  4. .createSelectorQuery()
  5. .select(selector)
  6. .boundingClientRect()
  7. .exec(function (ret) {
  8. if (ret && ret[0]) {
  9. resolve(ret[0]);
  10. }
  11. else {
  12. resolve(null);
  13. }
  14. });
  15. });
  16. }