Using on-action syntax in amp-date-countdown results in "insufficient trust"
What's the issue?
Running the following code:
<amp-date-countdown
on="timeout: AMP.setState({foo: 'bar'});"
end-date="2017-07-04T16:46:00+08:00"
when-ended="stop">
</amp-date-countdown>
or on simpler on-syntax action like
<amp-date-countdown
on="timeout: mydiv.show;"
end-date="2017-07-04T16:46:00+08:00"
when-ended="stop">
</amp-date-countdown>
results in the following error, contrary to the documentation:
Insufficient trust for "setState" (1 < 100).
However, there is no error when the on-syntax action is done with an amp-animation, like on="timeout: anim.start;"
What browsers are affected?
All browsers
Which AMP version is affected?
Found in 1530567757224
Please refer to https://github.com/ampproject/amphtml/pull/13657#pullrequestreview-101786630 and https://github.com/ampproject/amphtml/issues/13973#issuecomment-372856471 for more informations
AMP.setState requires a user action to be triggered. We probably should have a more useful error message.
@micyeung @leonalicious Can you describe your intended use case?
@micyeung You can use amp-animation to hide and show sections of the page based on the timeout. https://github.com/ampproject/amphtml/blob/master/examples/amp-date-countdown.amp.html has an example for that.