> For the complete documentation index, see [llms.txt](https://memoryza.gitbook.io/chromedevtools-devtools-frontend/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://memoryza.gitbook.io/chromedevtools-devtools-frontend/platform-mo-kuai-fen-xi.md).

# platform模块分析

包含一堆全局的公用方法（例如runOnWindowLoad）和js api的扩展（例如promise和map的扩展）， 无外部依赖 ,按理来说他应该叫util

{% code title="/front\_end/platform/utilities.js" %}

```
function runOnWindowLoad(callback) {
  /**
   * @suppressGlobalPropertiesCheck
   */
  function windowLoaded() {
    self.removeEventListener('DOMContentLoaded', windowLoaded, false);
    callback();
  }

  if (document.readyState === 'complete' || document.readyState === 'interactive')
    callback();
  else
    self.addEventListener('DOMContentLoaded', windowLoaded, false);
}
```

{% endcode %}
