Skip to content

Module export format changed to Fetchr Class

Compare
Choose a tag to compare
@Vijar Vijar released this 11 Sep 17:58
· 575 commits to main since this release

Breaking changes:

  1. Fetchr now exports the class itself, rather than the class creating factory function.

    var Fetcher = require('fetchr')(), //Fetcher class
        fetcher = new Fetcher(); //Fetcher instance

    now becomes

    var Fetcher = require('fetchr'), //Fetcher class
        fetcher = new Fetcher(); //Fetcher instance
  2. addFetcher method renamed to registerFetcher. This is to keep the api somewhat consistent between fetchr and dispatchr.

  3. Fetcher.middleware() should no longer be mounted directly on the app. It should always be mounted on a path.

    app.use(Fetcher.middleware());

    now becomes

    app.use('/api', Fetcher.middleware());
  4. pathPrefix config option renamed to xhrPath.

    • This config option used to be passed into the class creator function, but is now passed into the class upon instantiation.
    • This option's value should point to the exact path the Fetcher.middleware() was mounted on.