Trigger an action repeatedly

Would that be the best way to repeatedly trigger an event, say once every x seconds?

Something akin to:

<WhileActive>
	<Repeat Delay="x">
		<Callback Handler="{someJSFunction}"/>
	</Repeat>
</WhileActive>

I have an app that needs to periodically check for updates. I am currently attempting to do that in a global js module via a recursive setTimeout loop, but sometimes upon page change the js vm seems to forget about timeouts.

As I don’t technically need this callback on all pages, it seems it would make more sense to have something akin to the example code above on each page where I do need it.

Is there anything similiar to Repeat or an easy way of doing the above? Cheers

Timeline has a PlayMode="Wrap" option. You can add Callback actions with a Delay.

How would I activate the Timeline with WhileActive and have it loop as long as WhileActive was above a threshold?

It does seem that there is no clear way to simply start/stop the animation in While trigger using a simple Change event. I’m going to make an issue for this.

In the meantime you can pause/resume the playback with something like:

<WhileActive Bypass="Never">
   <Resume Target="myTimeline" Direction="Forward"/>
   <Pause Target="myTimeline" Direction="Backward"/>
</WhileActive>

Also note, I just fixed some issues with Timeline in regards to this setup, so an upcoming release should also help out a bit.

Thanks

I have a couple of final questions:

I currently have code which looks like…

<Timeline ux:Name="myTimeline" PlayMode="Wrap">
	<Callback Handler="{myFunction1}" Delay="2" />
	<Callback Handler="{myFunction2}" Delay="3" />
</Timeline>

<WhileActive Bypass="Never">
	<Resume Target="myTimeline" Direction="Forward" />
	<Pause Target="myTimeline" Direction="Backward" />
</WhileActive>

For the Pause and Resume classes I’m receiving the warnings:

Deprecated: Use `Trigger.When` instead of `Trigger.Direction` in Fuse.Triggers.Actions.Resume<...\Fuse.Triggers\0.43.11\actions\$.uno:853>
Deprecated: Use `Trigger.When` instead of `Trigger.Direction` in Fuse.Triggers.Actions.Pause<...\Fuse.Triggers\0.43.11\actions\$.uno:853>

Am I doing something wrong here, or is this a bug in Fuse?


When I have items in the timeline, with PlayMode on Wrap it seems the last action is always skipped (presumably because the timeline immediately wraps back when it reaches the final action, without executing it?). So currently I have to have a placeholder Callback at the end of the timeline, in order to stretch it a little.

Is there a better way of handling this?

Thanks

Use When="Forward" instead of Direction="Forward". There were additional options added that aren’t direction-based thus a new name was introduced.

There is a defect in the current release with actions at the ends of wrapping timelines (up to a single frame of actions near the end may be skipped). This is one the issues I fixed; it’ll be available in an upcoming release. Placing those items at the Delay="0" instead should work, or extending the timeline as you have done.

Okay. The When property sounded like it would have done something different (sounds like a clause, rather than a specifier) to Direction.

Cheers.