我如何将 RxJS-jQuery 与 browserify 的 require 一起使用
How can I use RxJS-jQuery with browserify's require
我用jQuery in my app. I bundle all my source files with browserify. Thus, I import the npm version of jQuery:
const $ = require('jQuery');
我也使用RxJS and like to use the jQuery Bindings for the Reactive Extensions for JavaScript,但是如果我require('rxjs-jquery')
我只得到Rx
对象。我怎样才能要求 jQuery 对象能够使用这个例子:
function searchWikipedia(term) {
return $.ajaxAsObservable({
url: 'http://en.wikipedia.org/w/api.php',
data: { action: 'opensearch',
search: term,
format: 'json' }
dataType: 'jsonp'
});
}
您可以拥有多个 require
。
const $ = require('jQuery');
const rxJq = require('rxjs-jquery');
我用jQuery in my app. I bundle all my source files with browserify. Thus, I import the npm version of jQuery:
const $ = require('jQuery');
我也使用RxJS and like to use the jQuery Bindings for the Reactive Extensions for JavaScript,但是如果我require('rxjs-jquery')
我只得到Rx
对象。我怎样才能要求 jQuery 对象能够使用这个例子:
function searchWikipedia(term) {
return $.ajaxAsObservable({
url: 'http://en.wikipedia.org/w/api.php',
data: { action: 'opensearch',
search: term,
format: 'json' }
dataType: 'jsonp'
});
}
您可以拥有多个 require
。
const $ = require('jQuery');
const rxJq = require('rxjs-jquery');