blob: ce15a250a88062bb2e18f0402d2c8d63b6ca309b [file] [log] [blame]
<!DOCTYPE html>
<!--
Copyright (c) 2015 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.
-->
<link rel="import" href="/base/units/size_in_bytes.html">
<polymer-element name="tr-ui-u-size-in-bytes-span">
<template>
<style>
:host {
display: flex;
flex-direction: row;
align-items: center;
}
</style>
<span id="content"></span>
</template>
<script>
'use strict';
Polymer({
ready: function() {
this.$.content.textContent = String.fromCharCode(9888);
this.numBytes_ = undefined;
},
get numBytes() {
return this.numBytes_;
},
set numBytes(numBytesOrSizeInBytes) {
if (numBytesOrSizeInBytes instanceof tr.b.units.SizeInBytes)
this.numBytes_ = numBytesOrSizeInBytes.numBytes;
else
this.numBytes_ = numBytesOrSizeInBytes;
this.$.content.textContent =
tr.b.units.SizeInBytes.format(this.numBytes_);
},
get stringContent() {
return this.$.content.textContent;
}
});
</script>
</polymer-element>