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: am5.net.myVariable
 *                    am5.net.myFunction()
 * --------------------------------------------------------
 */
import * as am5 from "@amcharts/amcharts5";

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

/**
 * --------------------------------------------------------
 * Include via "index.js"
 * E.g.: "https://cdn.amcharts.com/lib/5/index.js"
 * Access items like: am5.net.myVariable
 *                    am5.net.myFunction()
 * --------------------------------------------------------
 */

Variables

Net does not have any variables.

Functions

load(

url: string,
target?: A,
options?: INetRequestOptions

)

#

Returns Promise

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
Click here for more info

readBlob(

blob: Blob

)

#

Returns Promise

Returns textual representation of a Blob object.