Skip to content

Net

Type module

Sources

Items from Net can be imported/included and used via following ways.

/**
* Import via main package
* Access items like: am4core.net.myVariable
*/
import * as am4core from "@amcharts/amcharts4";
/**
* Import via: Net.ts
* Access items like: $net.myVariable
*/
import * as $net from "@amcharts/amcharts4/Net";

Variables

Net does not have any variables.

Functions

load(url: string,
target?: A,
options?: INetRequestOptions
)

Returns Promise <INetLoadResult <A>>

Loads an external file via its URL.

Please note that this is an asynchronous function.

It will not return the result, but rather a Promise.

You can use the await notion, or then().

// Using await
let response = await Net.load( "http://www.my.com/data.json" );
console.log( response.response );

// Using then()
Net.load( "http://www.my.com/data.json" ).then( ( response ) => {
  console.log( response.response );
} );
// Using then()
Net.load( "http://www.my.com/data.json" ).then( function( response ) {
  console.log( response.response );
} );
readBlob(blob: Blob)

Returns Promise <string>

Returns textual representation of a Blob object.