What I’m trying to do is print/use the value of the Polyline attribute.
JavaScript
x
2
1
<Polyline points="x,y x,y x,y x,y">
2
I’ve tried to get them with these methods:
This is an util function
JavaScript
1
8
1
export const getPointAttribute = async () => {
2
const polyline = s.polyline;
3
const polylineData = ClientFunction(() => polyline().attributes, {
4
dependencies: { polyline }
5
});
6
return polylineData
7
}
8
This is inside the test script
JavaScript
1
4
1
test('', async (t) => {
2
console.log(u.getPointAttribute())
3
}
4
or
JavaScript
1
4
1
test('', async (t) => {
2
console.log(s.polyline.getAttribute('points'));
3
}
4
And I include my selectors external
JavaScript
1
2
1
import * as s from '../utilities/selectors';
2
But all I get is a promise as output in the console log
Promise { }
or
ReExecutablePromise { _then: [], _fn: [Function], _taskPromise: null }
Any help is appreciated!
Advertisement
Answer
You should await the call inside the console.log:
JavaScript
1
4
1
test('', async (t) => {
2
console.log(await s.polyline.getAttribute('points'));
3
}
4
or
JavaScript
1
4
1
test('', async (t) => {
2
console.log(await s.polyline.getAttribute('points'));
3
}
4