1.2.3 • Published 9 years ago

xhr-ext-promise v1.2.3

Weekly downloads
2
License
MIT
Repository
github
Last release
9 years ago

xhr-ext-promise

honeo/xhr-ext-promise
xhr-ext-promise

なにこれ

よくあるPromise対応のXHRラッパー。
ブラウザ用、今んとこGetとPostのみ。

使い方

$ npm i xhr-ext-promise
const XEP = require('xhr-ext-promise');
XEP.method({...}).then( (doc)=>{
	console.log(doc); // document
});

Method

全てPromiseインスタンスを返して、取得したdocumentを引数にresolve()する。
取得したdocumentに body, head, domain, URL プロパティがない場合は付与する。

XHP.getDocument({url: 'URL or PATH'});
XEP.formToDocument({form: HTMLFormDocument});
XEP.postToDocument({action: 'URL or PATH'});

// option example
XEP.method({
	onprogress(e){
		console.log(e); // Object{...}
	},
	//method: string,
	user: string, 		// default=''
	password: string, 	// default=''
	timeout: 0, 		// default=XEP.timeout_method
	interval: 0, 		// default=XEP.interval_method
	send: 'hoge=fuga&sega=newhard', // default=null
	withCredentials: boolean //default=false
});

Properties

.interval_get, .interval_post

それぞれ前回get, postから次回までに空けるmsの標準値。

.timeout_get, timeout_post

それぞれget, postに設定するタイムアウトの標準値。

1.2.3

9 years ago

1.2.2

9 years ago

1.2.1

9 years ago

1.2.0

10 years ago

1.1.1

10 years ago

1.1.0

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago