Net

Type module

Sources

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

/**
 * --------------------------------------------------------
 * Import via main package: core.ts
 * Access items like: am4core.net.myVariable
 *                    am4core.net.myFunction()
 * --------------------------------------------------------
 */
import * as am4core from "@amcharts/amcharts4";

/**
 * --------------------------------------------------------
 * Import via: Net.ts
 * Access items like: $net.myVariable
 *                    $net.myFunction()
 * --------------------------------------------------------
 */
import * as $net from "@amcharts/amcharts4/Net";

/**
 * --------------------------------------------------------
 * Include via "core.js"
 * Access items like: am4core.net.myVariable
 *                    am4core.net.myFunction()
 * --------------------------------------------------------
 */

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 );
} );

@async

readBlob(

blob: Blob

)

#

Returns Promise < string >

Returns textual representation of a Blob object.