1

The Situation

You are inside the JavaScript USE API for Sightly/HTL.

use([], function () {

  //your code here

  return {};
});

You then get a reference to a child resource like this:

var childRes = resource.getChild('my-child-node');

The Question

How do you get properties off of that resource?

hint: childRes.getValueMap() will give an exception.

org.mozilla.javascript.EcmaError: TypeError: Cannot find function getValueMap

lance.dolan
  • 3,493
  • 27
  • 36

1 Answers1

3

Have you tried childRes.adaptTo(Packages.org.apache.sling.api.resource.ValueMap)?

Daniel Platon
  • 583
  • 7
  • 16
  • Not excited about the fully qualified name in JS, but I suppose I'll have to get used to that if I'm going the JS Use Api route. Thanks. – lance.dolan Feb 03 '17 at 20:32