Giter VIP home page Giter VIP logo

qiao.util.js's Introduction

urls

homepage

https://code.insistime.com/qiao.util.js

github

https://github.com/insistime/qiao.util.js

npm

https://www.npmjs.com/package/qiao.util.js

started

install

npm install qiao.util.js

dependencies

  1. qiao.ajax by reqwest
  2. qiao.cookie by js-cookie
  3. qiao.ls by qiao.ls.js
  4. qiao.qrcode by qrcode

documentation

  1. qiao.ajax, reqwest, https://www.npmjs.com/package/reqwest
  2. qiao.cookie, js-cookie, https://www.npmjs.com/package/js-cookie
  3. qiao.ls, qiao.ls.js, https://www.npmjs.com/package/qiao.ls.js
  4. qiao.qrcode, qrcode, https://www.npmjs.com/package/qrcode

api

qiao.ajax

'use strict';

var qiao = require('qiao.util.js');

var test = function(){
	qiao.ajax({
	    url: 'path/to/html'
	  , method: 'post'
	  , data: { foo: 'bar', baz: 100 }
	  , success: function (resp) {
	      qwery('#content').html(resp)
	    }
	});
	 
	qiao.ajax({
	    url: 'path/to/html'
	  , method: 'get'
	  , data: [ { name: 'foo', value: 'bar' }, { name: 'baz', value: 100 } ]
	  , success: function (resp) {
	      qwery('#content').html(resp)
	    }
	});
	 
	qiao.ajax({
	    url: 'path/to/json'
	  , type: 'json'
	  , method: 'post'
	  , error: function (err) { }
	  , success: function (resp) {
	      qwery('#content').html(resp.content)
	    }
	});
	 
	qiao.ajax({
	    url: 'path/to/json'
	  , type: 'json'
	  , method: 'post'
	  , contentType: 'application/json'
	  , headers: {
	      'X-My-Custom-Header': 'SomethingImportant'
	    }
	  , error: function (err) { }
	  , success: function (resp) {
	      qwery('#content').html(resp.content)
	    }
	});
	 
	// Uses XMLHttpRequest2 credentialled requests (cookies, HTTP basic auth) if supported 
	qiao.ajax({
	    url: 'path/to/json'
	  , type: 'json'
	  , method: 'post'
	  , contentType: 'application/json'
	  , crossOrigin: true
	  , withCredentials: true
	  , error: function (err) { }
	  , success: function (resp) {
	      qwery('#content').html(resp.content)
	    }
	});
	 
	qiao.ajax({
	    url: 'path/to/data.jsonp?callback=?'
	  , type: 'jsonp'
	  , success: function (resp) {
	      qwery('#content').html(resp.content)
	    }
	});
	 
	qiao.ajax({
	    url: 'path/to/data.jsonp?foo=bar'
	  , type: 'jsonp'
	  , jsonpCallback: 'foo'
	  , jsonpCallbackName: 'bar'
	  , success: function (resp) {
	      qwery('#content').html(resp.content)
	    }
	});
	
	qiao.ajax({
	    url: 'path/to/data.jsonp?foo=bar'
	  , type: 'jsonp'
	  , jsonpCallback: 'foo'
	  , success: function (resp) {
	      qwery('#content').html(resp.content)
	    }
	  , complete: function (resp) {
	      qwery('#hide-this').hide()
	    }
	});
};

test();

qiao.cookie

'use strict';

var qiao = require('qiao.util.js');

var test = function(){
	// set
	qiao.cookie('name', 'value');
	
	// get
	console.log(qiao.cookie('name'));
	
	// delete
	qiao.cookie('name', null);
	console.log(qiao.cookie('name'));
};

test();

qiao.ls

'use strict';

var qiao = require('qiao.util.js');

var test = function(){
	// set
	qiao.ls('name', 'value');
	
	// get
	console.log(qiao.ls('name'));
	
	// delete
	qiao.ls('name', null);
	console.log(qiao.ls('name'));
};

test();

qiao.qrcode

'use strict';

var qiao = require('qiao.util.js');

var test = function(){
	// need <div id="qrcode" style="width:100px;height:100px;"></div>
	
	// canvas
	qiao.qrcode({
		id	: 'qrcode',
		type: 'canvas',
		text: 'http://insistime.com/'
	});

	// img
	qiao.qrcode({
		id	: 'qrcode',
		type: 'img',
		text: 'http://insistime.com/'
	});
	
	// svg
	qiao.qrcode({
		id	: 'qrcode',
		type: 'svg',
		text: 'http://insistime.com/'
	});
};

test();

qiao.search

'use strict';

var qiao = require('qiao.util.js');

var test = function(){
	// url http://www.baidu.com?q=1
	var s = qiao.search('q');
	
	// s = 1
	console.log(s);
};

test();

version

0.1.1.20190624

  1. add qiao.ls.js
  2. update npms

0.1.0.20190621

  1. add file type

0.0.9.20190605

  1. add vendor

0.0.8.20180720

  1. https homepage

0.0.7.20180719

  1. modify readme.md

0.0.6.20180319

  1. add qrcode keyword

0.0.5.20180318

  1. qiao.qrcode

0.0.4.20180313

  1. qiao.search

0.0.3.20180305

  1. modify md

0.0.2.20180301

  1. qiao.ajax

0.0.1.20180227

  1. init project
  2. qiao.cookie

qiao.util.js's People

Contributors

uikoo9 avatar

Watchers

James Cloos 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.