Skip to content

Commit 5d7eeb8

Browse files
authored
Merge pull request #19 from nstudio/feat/polyfill
fix(): polyfill fixes
2 parents d003a86 + c26c688 commit 5d7eeb8

File tree

14 files changed

+4946
-1524
lines changed

14 files changed

+4946
-1524
lines changed

demo/app/assets/test.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"first": "Osei",
3+
"last": "Fortune"
4+
}

demo/app/assets/test.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Osei Fortune

demo/app/home/home-page.ts

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { Async } from 'nativescript-http-async';
2-
console.log(new Async().message);
1+
import { TNSXMLHttpRequest } from 'nativescript-http-async';
2+
33
/*
44
In NativeScript, a file with the same name as an XML file is known as
55
a code-behind file. The code-behind is a great place to place your view
@@ -9,9 +9,31 @@ logic, and to set up your page’s data binding.
99
import { NavigatedData, Page } from "tns-core-modules/ui/page";
1010

1111
import { HomeViewModel } from "./home-view-model";
12-
1312
export function onNavigatingTo(args: NavigatedData) {
1413
const page = <Page>args.object;
1514

1615
page.bindingContext = new HomeViewModel();
16+
const xhr = new TNSXMLHttpRequest();
17+
setTimeout(()=>{
18+
xhr.open('GET','~/assets/test.json');
19+
xhr.responseType = 'blob';
20+
xhr.onloadstart = ()=>{
21+
console.log('onstart');
22+
}
23+
xhr.onloadend = ()=>{
24+
console.log('onloadend')
25+
}
26+
xhr.onerror = ()=>{
27+
console.log('onerror');
28+
}
29+
xhr.onreadystatechange = function () {
30+
console.log('state', xhr.readyState, 'status', xhr.status);
31+
if (xhr.readyState === 4 && xhr.status === 200) {
32+
console.log('response', xhr.response);
33+
//console.log('responseText', xhr.responseText);
34+
}
35+
};
36+
xhr.send()
37+
})
38+
1739
}

demo/nsconfig.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
{
2-
"useLegacyWorkflow": false
3-
}
1+
{}

0 commit comments

Comments
 (0)