Extendable base adapter class used by @pollyjs

Record, Replay, and Stub HTTP Interactions

The @pollyjs/adapter package provides an extendable base adapter class that contains core logic dependent on by the Fetch & XHR adapters.


Note that you must have node (and npm) installed.

npm install @pollyjs/adapter -D

If you want to install it with yarn:

yarn add @pollyjs/adapter -D


Check out the Custom Adapter documentation for more details.


import Adapter from '@pollyjs/adapter';

class CustomAdapter extends Adapter {
  static get name() {
    return 'custom';

  onConnect() {
    /* Do something when the adapter is connect to */

  onDisconnect() {
    /* Do something when the adapter is disconnected from */

For better usage examples, please refer to the source code for the Fetch & XHR adapters.


Copyright (c) 2018 Netflix, Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at


Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.





  • 如何使用chrome调试iphone页面?-- remotedebug-ios-webkit-adapter 安装与使用

    使用chrome devtools 调试 iphone 页面,需安装 remotedebug-ios-webkit-adapter 工具。 这个 adapter 可牛批坏了,可以通过VS Code,C...

    1 年前
  • 【30秒一个知识点】Adapter

    本系列翻译自开源项目 30-seconds-of-code 这是一个非常优秀的系列,文章总结了大量的使用es6语法实现的代码模块不是说真的三十秒就能理解,也需要你认真的思考,其中有一些点非常精妙,...

    2 年前
  • webrtc-adapter-test

    Hide browser differences in WebRTC APIs (test package name) WebRTC adapter [adapter.js] is a shim t...

    1 年前
  • webrtc-adapter

    A shim to insulate apps from WebRTC spec changes and browser prefix differences WebRTC adapter adap...

    2 年前
  • waterline-adapter-tests

    Integration tests for waterline adapters Waterline Adapter Tests A set of integration tests that ...

    1 年前
  • vue2.0+axios+mock+axios-mock+adapter实现登陆

    做项目过程中,需要用到后台模拟数据,在机缘巧合下发现了mock,在学习使用的过程中又偶遇了axios-mock-adapter。现在将实例展示如下: 准备 实例是建立在vue-cli的基础上实现 ...

    2 年前
  • vue-jscodeshift-adapter

    Run jscodeshift on Vue single file components vue-jscodeshift-adapter Run jscodeshift on Vue singl...

    2 个月前
  • vscode-debugadapter

    Debug adapter implementation for node VS Code Debug Adapter Npm module to implement a VS Code debu...

    1 年前
  • unexpected-htmllike-testrenderer-adapter

    Adapter for unexpected-htmllike for react-test-renderer unexpected-htmllike-testrenderer-adapter Thi...

    1 年前
  • unexpected-htmllike-reactrendered-adapter

    undefined unexpected-htmllike-reactrendered-adapter CDN by jsDelivr...

    2 个月前


扫码加入 JavaScript 社区