
In mojom, there's a notion of a request/response pair. This CL teaches the JS bindings not to GC a message pipe after a request has been issued but before the response has been received. R=hansmuller@chromium.org Review URL: https://codereview.chromium.org/696373003
42 lines
1.1 KiB
Plaintext
42 lines
1.1 KiB
Plaintext
<!--
|
|
// Copyright 2014 The Chromium Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
-->
|
|
<import src="../framework/sky-element/sky-element.sky" as="SkyElement" />
|
|
<import src="../framework/xmlhttprequest.sky" as="XMLHttpRequest" />
|
|
|
|
<template>
|
|
<style>
|
|
heading {
|
|
font-size: 16px;
|
|
}
|
|
</style>
|
|
<heading>File browser for {{ url }}</heading>
|
|
<template repeat="{{ directory in directories }}">
|
|
<a href="{{ directory }}">{{ directory }}</a>
|
|
</template>
|
|
<template repeat="{{ file in files }}">
|
|
<a href="{{ file }}">{{ file }}</a>
|
|
</template>
|
|
</template>
|
|
<script>
|
|
SkyElement({
|
|
name: 'file-browser',
|
|
url: '',
|
|
files: [],
|
|
directories: [],
|
|
attached: function() {
|
|
this.url = this.ownerDocument.URL;
|
|
var xhr = new XMLHttpRequest();
|
|
xhr.open('GET', this.url + '?format=json');
|
|
xhr.onload = (function() {
|
|
var listing = JSON.parse(xhr.responseText);
|
|
this.files = listing.files;
|
|
this.directories = listing.directories;
|
|
}).bind(this);
|
|
xhr.send();
|
|
}
|
|
});
|
|
</script>
|