tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

and.js (715B)


      1 /* This Source Code Form is subject to the terms of the Mozilla Public
      2 * License, v. 2.0. If a copy of the MPL was not distributed with this
      3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      4 
      5 /* global ConditionBase */
      6 
      7 /**
      8 * AND condition
      9 */
     10 class ConditionAnd extends ConditionBase {
     11  #conditions;
     12 
     13  constructor(factory, desc) {
     14    super(factory, desc);
     15 
     16    this.#conditions = desc.conditions.map(c => factory.create(c));
     17  }
     18 
     19  async init() {
     20    for (const c of this.#conditions) {
     21      await c.init();
     22    }
     23  }
     24 
     25  check() {
     26    for (const c of this.#conditions) {
     27      if (!c.check()) {
     28        return false;
     29      }
     30    }
     31    return true;
     32  }
     33 }
     34 
     35 globalThis.ConditionAnd = ConditionAnd;