npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

vuejs-ajax

v1.3.97

Published

It is a XHR plugin that works in specific features for Vue.js 2.x and and above versions. It has many similar features with `jQuery`'s `ajax()` and `Angular`'s `http()`. In addition to these, it also has its own practical features. For example, `assets`,

Downloads

70

Readme

vuejs-ajax

Travis Build Version Downloads

It is a XHR plugin that works in specific features for Vue.js 2.x and and above versions. It has many similar features with jQuery's ajax() and Angular's $http().

It allows you to write more tidy code by solving many of the most common features used by developers in the core. Here are a few examples:

Prevent Duplicate Requests

One of the most common problems is the problem of sending dublicate requests at the same time. Vue.js Ajax solve it easily. You can find more information here.

File Uploading

File uploading with Ajax (XMLHttpRequest) can sometimes require you to write extra code. But it's very simple to do it with Vue.js Ajax. You can find more information here.

History

History feature to create a faster browsing experience. This means less elements to load and therefore faster browsing. But it's very simple to do it with Vue.js Ajax. There is a detailed explanation to here.

CSRF

This setting provides protection against CSRF attacks. You can find more information here.

Component Shifter

There is also Component Shifter which solves a different task. With componentShifter() you can load (with Vue.ajax) and render your Vue template (html) in your application by dynamic & async Vue.component(). You can also add components and run them nested. You can find more information here.


Setup

npm install vuejs-ajax --save

Usage

// ES6
import ajax from "vuejs-ajax"
Vue.use(ajax)

// ES5
var ajax = require("vuejs-ajax")
Vue.use(ajax)

Getting Started

The general shorthand version is as follows:

Vue.ajax.get(string url[, object data] [,object configurations])
    .then(function success[, function error])

Arguments

| Property | Required | Type | Description | | ---------------- | -------- | ---------------- | ------------------------------------------------------------- | | url | Yes | String | A string containing the URL to which the request is sent. | | data | No | Object | A plain object that is sent to the server with the request. | | configurations | No | Object | A set of key/value pairs that configure the Vue.ajax request. |

All of the above methods are a shorthand method of the Vue.ajax():

Vue.ajax({
    url: "http://example.com",
    method: "get" // post, put, patch, delete, head, jsonp
}).then(function(response) {
    console.log("Success", response.data)
}, function(response) {
    console.log("Error", response.statusText)
})

You can find detailed information about the Methods here.

Configurations

| Configuration | Type | Default | Available | | --------------------------------------------- | ---------------- | ------- | ------------------------------------------ | | assets | String Or Object | - | - | | async | Boolean | true | true, false | | cache | Boolean | false | true, false | | complete | Function | - | - | | csrf | Boolean | true | true, false | | data | Object | - | - | | fileInputs | Element Object | - | Input file upload objects | | hardReloadOnError | Boolean | false | true, false | | history | Boolean | false | true, false | | headers | Object | - | - | | method | String | get | delete, get, head, jsonp, patch, post, put | | preventDuplicate | Boolean | true | true, false | | scrollTop | Boolean | false | true, false | | timeout | Integer | 60000 | Time in milliseconds | | title | String | - | - | | url | String | - | - | | urlData | Object | - | - | | withCredentials | Boolean | false | true, false |


License

MIT

Copyright (c) 2019 Fatih Koca