Skip to content

Instantly share code, notes, and snippets.

@tonmcg
Created May 24, 2018 00:55
Show Gist options
  • Save tonmcg/ad4d161231a226c670c47bffe529a23e to your computer and use it in GitHub Desktop.
Save tonmcg/ad4d161231a226c670c47bffe529a23e to your computer and use it in GitHub Desktop.
M Language XHR Functions
let
javascriptDates = Web.Page("
<script type='text/javascript'>
function wait(ms){
var start = new Date().getTime();
var end = start;
while(end < start + ms) {
end = new Date().getTime();
}
}
time = new Date();
document.write('<p>',time,'</p>');
wait(7000);
time1 = new Date();
document.write('<p>',time1,'</p>');
</script>
"){0}[Data]{0}[Children]{1}[Children][Children],
count = List.Count(javascriptDates),
readDates =
List.Generate(
()=>
[
n = 0,
text = javascriptDates{n}[Text]{0}
], // initial
each [n] < count, // condition
each
[
n = [n] + 1,
text = javascriptDates{n}[Text]{0}
], // next
each [text] // selector
)
in
readDates
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment