update documentation

This commit is contained in:
Leon van Kammen 2023-03-09 22:39:59 +01:00
parent 5b296c5d22
commit 66fe5ee5a0
3 changed files with 34 additions and 2 deletions

View File

@ -1,8 +1,7 @@
-dce full
-cp src
xrfragment.Url
xrfragment.Query
xrfragment
-D shallow-expose
-js dist/xrfragment.js

28
dist/xrfragment.js vendored
View File

@ -14,6 +14,10 @@ EReg.prototype = {
this.r.s = s;
return this.r.m != null;
}
,split: function(s) {
var d = "#__delim__#";
return s.replace(this.r,d).split(d);
}
};
var HxOverrides = function() { };
HxOverrides.substr = function(s,pos,len) {
@ -72,6 +76,9 @@ Std.parseInt = function(x) {
}
return null;
};
var haxe_ds_StringMap = function() {
this.h = Object.create(null);
};
var haxe_iterators_ArrayIterator = function(array) {
this.current = 0;
this.array = array;
@ -276,6 +283,27 @@ xrfragment_Query.prototype = {
}
}
};
var xrfragment_Url = $hx_exports["xrfragment"]["Url"] = function() { };
xrfragment_Url.parseQueryMap = function(qs) {
var splitArray = qs.split("&");
var regexPlus = new EReg("\\+","g");
var resultMap = new haxe_ds_StringMap();
var _g = 0;
var _g1 = splitArray.length;
while(_g < _g1) {
var i = _g++;
var splitByEqual = splitArray[i].split("=");
var key = splitByEqual[0];
if(splitByEqual.length == 1) {
resultMap.h[key] = "";
} else {
var s = regexPlus.split(splitByEqual[1]).join(" ");
var value = decodeURIComponent(s.split("+").join(" "));
resultMap.h[key] = value;
}
}
return resultMap;
};
if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) {
HxOverrides.now = performance.now.bind(performance);
}

View File

@ -1,9 +1,14 @@
package xrfragment;
@:expose // <- makes the class reachable from plain JavaScript
@:keep // <- avoids accidental removal by dead code elimination
class Url {
@:keep
private static var map:Map<String, String>;
@:keep
private static function parseQueryMap(qs:String):Map<String, String> {
var splitArray:Array<String> = qs.split('&');
var regexPlus = ~/\+/g; // Regex for replacing addition symbol with a space