net property

Object? get net

Specifies if the net permission should be requested or revoked. if set to "inherit", the current net permission will be inherited. if set to true, the global net permission will be requested. if set to false, the global net permission will be revoked. if set to string[], the net permission will be requested with the specified host strings with the format "<host>[:<port>].

@default {false}

Examples:

import { assertEquals } from "https://deno.land/std/testing/asserts.ts";

Deno.test({
  name: "inherit",
  permissions: {
    net: "inherit",
  },
  async fn() {
    const status = await Deno.permissions.query({ name: "net" })
    assertEquals(status.state, "granted");
  },
});
import { assertEquals } from "https://deno.land/std/testing/asserts.ts";

Deno.test({
  name: "true",
  permissions: {
    net: true,
  },
  async fn() {
    const status = await Deno.permissions.query({ name: "net" });
    assertEquals(status.state, "granted");
  },
});
import { assertEquals } from "https://deno.land/std/testing/asserts.ts";

Deno.test({
  name: "false",
  permissions: {
    net: false,
  },
  async fn() {
    const status = await Deno.permissions.query({ name: "net" });
    assertEquals(status.state, "denied");
  },
});
import { assertEquals } from "https://deno.land/std/testing/asserts.ts";

Deno.test({
  name: "localhost:8080",
  permissions: {
    net: ["localhost:8080"],
  },
  async fn() {
    const status = await Deno.permissions.query({ name: "net", host: "localhost:8080" });
    assertEquals(status.state, "granted");
  },
});

Implementation

_i2.Object? get net => _i3.getProperty(
      this,
      'net',
    );
set net (Object? value)

Implementation

set net(_i2.Object? value) {
  _i3.setProperty(
    this,
    'net',
    value ?? _i6.undefined,
  );
}