Giter Club home page Giter Club logo

salt-fetch's Introduction

salt.fetch

独立的ajax/jsonp模块。

特别说明

salt.fetch就是 nattyFetchnattyStorage 的引用合集,看源代码便知。

为什么这么做?为了给salt的使用者提供一致的开发体验,故将nattyFetch工具以fetch属性的方式集成在salt命名空间下。

安装

通过npm下载代码,目前最新版本为2.0.0

npm install salt-fetch --save

插入代码

<script src="path/to/node_modules/salt-fetch/dist/salt-fetch.js"></script>

文档

salt.fetch的特点和文档,直接见 nattyFetch 的文档即可。原文档中使用nattyFetch的地方,都可以直接使用salt.fetch替换,一模一样,如:

nattyFetch文档:

const context = nattyFetch.context({
    urlPrefix: '//example.com/api/'
});
context.create({
    getList: {
        url: 'getList.do',
        plugins: [
            nattyFetch.plugin.soon
        ]
    }
});
module.exports = context.api;

使用salt.fetch后:

const context = salt.fetch.context({ // 用`salt.fetch`替换`nattyFetch`
    urlPrefix: '//example.com/api/'
});
context.create({
    getList: {
        url: 'getList.do',
        plugins: [
            salt.fetch.plugin.soon // 用`salt.fetch`替换`nattyFetch`
        ]
    }
});
module.exports = context.api;

salt.fetchnattyFetch的不同之处:

  • salt.fetch只有移动端版本。
  • salt-fetch.js文件内置了natty-fetch.jsnatty-storage.js两个文件的内容。而natty-fetch.js没有内置natty-storage.js文件的内容。

salt-fetch's People

Contributors

jias avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.