Skip to content
This repository has been archived by the owner on Feb 28, 2019. It is now read-only.
/ arez-timeddisposer Public archive

Arez utility that will dispose specified node after a delay

License

Notifications You must be signed in to change notification settings

arez/arez-timeddisposer

Repository files navigation

Deprecated

This project has been deprecated. In modern versions of Arez it is trivial to reimplement if required.

Arez-TimedDisposer

Build Status

This library provides a utility class that will dispose a target object after a time delay.

Quick Start

The simplest way to use component;

  • add the following dependencies into the build system. i.e.
<dependency>
   <groupId>org.realityforge.arez.timeddisposer</groupId>
   <artifactId>arez-timeddisposer</artifactId>
   <version>0.57</version>
</dependency>
  • add the snippet <inherits name="arez.timeddisposer.TimedDisposer"/> into the .gwt.xml file.

  • Use the TimedDisposer component. eg.

import arez.Arez;
import arez.Disposable;
import arez.Observer;
import arez.ticker.IntervalTicker;
import arez.timeddisposer.TimedDisposer;
import com.google.gwt.core.client.EntryPoint;
import elemental2.dom.DomGlobal;

public class TimedDisposerExample
  implements EntryPoint
{
  @Override
  public void onModuleLoad()
  {
    final IntervalTicker ticker = IntervalTicker.create( 1000 );
    final Observer observer = Arez.context().autorun( () -> {
      if ( !Disposable.isDisposed( ticker ) )
      {
        DomGlobal.console.log( "Tick: " + ticker.getTickTime() );
      }
      else
      {
        DomGlobal.console.log( "Ticker disposed!" );
      }
    } );
    TimedDisposer.create( Disposable.asDisposable( ticker ), 5500 );
    TimedDisposer.create( Disposable.asDisposable( observer ), 7000 );
  }
}

More Information

For more information about component, please see the Website. For the source code and project support please visit the GitHub project.

Contributing

The component was released as open source so others could benefit from the project. We are thankful for any contributions from the community. A Code of Conduct has been put in place and a Contributing document is under development.

License

The component is licensed under Apache License, Version 2.0.

About

Arez utility that will dispose specified node after a delay

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published