Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

angular-wait-until

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

angular-wait-until

Try repeatedly for a promise to be resolved/return true

  • 0.0.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4
increased by300%
Maintainers
1
Weekly downloads
 
Created
Source

Build Status

Angular Wait Until

Wait until the executed promise resolved to a true value, Execute it every x milliseconds and stop after y milliseconds.

Install

npm install angular-wait-until

Usage

Angular Module

    angular.module('webApp', ['angular.wait-until'])

Inside a controller/service

    angular.module('webApp')
      .controller('myController', function ($scope, $q, WaitUntil) {
        var myPromise = new WaitUntil();
        var later = +Date.now() + 500;
        $scope.error = 'no error';
        
        myPromise
          .stopAfter(1 * 1000)
          .tryEvery(100)
          .stopOnFailure(false) //Ignore errors
          .execute(() => {
            return $q((resolve, reject) => {
              if (+Date.now() >= later) {
                return resolve(true); //some truthy value
              }
              reject(false);
            })
          })
          .then((value) => $scope.name = 'Yey')
          .catch((err) => $scope.error = err);
      });

Further Features

This repo is based on poll-until-promise. There you can read about additional features and functionality

Keywords

FAQs

Package last updated on 02 Feb 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc