rename routeresolver methods to {onmatch,view}
expose some piecemeal modules rename internal xhr to request mirror internal stream api to match public api
This commit is contained in:
parent
8bb813155c
commit
80c25e3809
18 changed files with 276 additions and 264 deletions
|
|
@ -10,8 +10,8 @@ module.exports = function($window, log) {
|
|||
var oncompletion
|
||||
function setCompletionCallback(callback) {oncompletion = callback}
|
||||
|
||||
function xhr(args) {
|
||||
var stream = Stream.stream()
|
||||
function request(args) {
|
||||
var stream = Stream()
|
||||
if (args.initialValue !== undefined) stream(args.initialValue)
|
||||
|
||||
var useBody = typeof args.useBody === "boolean" ? args.useBody : args.method !== "GET" && args.method !== "TRACE"
|
||||
|
|
@ -63,7 +63,7 @@ module.exports = function($window, log) {
|
|||
}
|
||||
|
||||
function jsonp(args) {
|
||||
var stream = Stream.stream()
|
||||
var stream = Stream()
|
||||
if (args.initialValue !== undefined) stream(args.initialValue)
|
||||
|
||||
var callbackName = args.callbackName || "_mithril_" + Math.round(Math.random() * 1e16) + "_" + callbackCount++
|
||||
|
|
@ -130,5 +130,5 @@ module.exports = function($window, log) {
|
|||
return data
|
||||
}
|
||||
|
||||
return {xhr: xhr, jsonp: jsonp, setCompletionCallback: setCompletionCallback}
|
||||
return {request: request, jsonp: jsonp, setCompletionCallback: setCompletionCallback}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
<script src="../../querystring/build.js"></script>
|
||||
<script src="../../util/stream.js"></script>
|
||||
<script src="../../request/request.js"></script>
|
||||
<script src="test-xhr.js"></script>
|
||||
<script src="test-request.js"></script>
|
||||
<script src="test-jsonp.js"></script>
|
||||
|
||||
<script>require("../../ospec/ospec").run()</script>
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ o.spec("xhr", function() {
|
|||
o.beforeEach(function() {
|
||||
mock = xhrMock()
|
||||
spy = o.spy()
|
||||
xhr = new Request(mock, spy).xhr
|
||||
xhr = new Request(mock, spy).request
|
||||
})
|
||||
|
||||
o.spec("success", function() {
|
||||
Loading…
Add table
Add a link
Reference in a new issue