每隔5分钟更改一页的图标

时间:2017-03-06 02:38:46

标签: angularjs ionic-framework

我想在open import Function using (const; _∘_; _on_) open import Relation.Binary open import Data.String using (String; toList∘fromList; fromList∘toList) renaming (toList to stringToList; fromList to stringFromList) open import Relation.Binary.List.Pointwise as Pointwise open import Relation.Binary.PropositionalEquality as P hiding (trans) open import Data.Char.Base renaming (toNat to charToNat) STO : StrictTotalOrder _ _ _ STO = record { Carrier = String ; _≈_ = _≡_ ; _<_ = _<_ ; isStrictTotalOrder = record { isEquivalence = P.isEquivalence ; trans = λ {x} {y} {z} → trans {x} {y} {z} ; compare = compare } } where open StrictTotalOrder Data.String.strictTotalOrder renaming (isEquivalence to string-isEquivalence; compare to string-compare) -- It feels like this should be defined somewhere in the -- standard library, but I can't find it... primCharToNat-inj : ∀ {x y} → primCharToNat x ≡ primCharToNat y → x ≡ y primCharToNat-inj _ = trustMe where open import Relation.Binary.PropositionalEquality.TrustMe open import Data.List lem : ∀ {xs ys} → Pointwise.Rel (_≡_ on primCharToNat) xs ys → xs ≡ ys lem [] = P.refl lem {x ∷ xs} {y ∷ ys} (x∼y ∷ p) with primCharToNat-inj {x} {y} x∼y lem {x ∷ xs} {_ ∷ ys} (x∼y ∷ p) | P.refl = cong _ (lem p) ≡-from-≈ : {s s′ : String} → s ≈ s′ → s ≡ s′ ≡-from-≈ {s} {s′} p = begin s ≡⟨ sym (fromList∘toList _) ⟩ stringFromList (stringToList s) ≡⟨ cong stringFromList (lem p) ⟩ stringFromList (stringToList s′) ≡⟨ fromList∘toList _ ⟩ s′ ∎ where open P.≡-Reasoning ≈-from-≡ : {s s′ : String} → s ≡ s′ → s ≈ s′ ≈-from-≡ {s} {_} refl = string-refl {s} where open IsEquivalence string-isEquivalence renaming (refl to string-refl) using () compare : (x y : String) → Tri (x < y) (x ≡ y) _ compare x y with string-compare x y compare x y | tri< a ¬b ¬c = tri< a (¬b ∘ ≈-from-≡) ¬c compare x y | tri≈ ¬a b ¬c = tri≈ ¬a (≡-from-≈ b) ¬c compare x y | tri> ¬a ¬b c = tri> ¬a (¬b ∘ ≈-from-≡) c 中编写一个脚本,每5分钟刷新一次页面,或者每隔5分钟调用一次API。我试图使用angular.element(document.querySelectorAll('.btn.center.second'))[0].dispatchEvent(new MouseEvent('click', { 'view': window, 'bubbles': true, 'cancelable': true })); 函数,但它不起作用。任何人都可以给我关于在哪里以及如何开始的想法?

2 个答案:

答案 0 :(得分:1)

试试这个

<!DOCTYPE html>
<html>
<head>
    <title></title>
</head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<script type="text/javascript">
    angular.module('myModule', [])
    .controller('myCtrl', function ($interval, $window) {
        $interval(function () {
      // loading page again
      // $window.location.reload();
      //you can modify it as you needd
      console.log('called in 5 seconds for 5 minutes change 5000 to  1000*60*5');
  }, 5000);
    });
</script>

<body ng-app="myModule" ng-controller="myCtrl">


</body>
</html>

被修改

 $interval(function () {
      // loading page again
      // $window.location.reload();
      //you can modify it as you needd
      $scope.timer = $scope.timer + 5000;
      console.log('called in 5 seconds for 5 minutes change 5000 to  1000*60*5');
  }, $scope.timer);

答案 1 :(得分:0)

这就是你需要的:

&#13;
&#13;
angular.module('test', [])
  .controller('test', function ($interval, $timeout, $window) {
    //$timeout( function () {
      $interval(function () {
        // Refresh page
        $window.location.reload();
        // Or call api
        //$http({
        //})
      }, 1000*60*5);
    //}, 1000);
  });
&#13;
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<div ng-app="test" ng-controller="test">
</div>
&#13;
&#13;
&#13;