Dart Documentationchrome.systemChromeSystemCpu

ChromeSystemCpu class

Use the system.cpu API to query CPU metadata.

class ChromeSystemCpu extends ChromeApi {
 static final JsObject _system_cpu = chrome['system']['cpu'];

 ChromeSystemCpu._();

 bool get available => _system_cpu != null;

 /**
  * Queries basic CPU information of the system.
  */
 Future<CpuInfo> getInfo() {
   if (_system_cpu == null) _throwNotAvailable();

   var completer = new ChromeCompleter<CpuInfo>.oneArg(_createCpuInfo);
   _system_cpu.callMethod('getInfo', [completer.callback]);
   return completer.future;
 }

 void _throwNotAvailable() {
   throw new UnsupportedError("'chrome.system.cpu' is not available");
 }
}

Extends

ChromeApi > ChromeSystemCpu

Properties

final bool available #

Returns true if the API is available. The common causes of an API not being avilable are:

  • a permission is missing in the application's manifest.json file
  • the API is defined on a newer version of Chrome then the current runtime
docs inherited from ChromeApi
bool get available => _system_cpu != null;

Methods

Future<CpuInfo> getInfo() #

Queries basic CPU information of the system.

Future<CpuInfo> getInfo() {
 if (_system_cpu == null) _throwNotAvailable();

 var completer = new ChromeCompleter<CpuInfo>.oneArg(_createCpuInfo);
 _system_cpu.callMethod('getInfo', [completer.callback]);
 return completer.future;
}