Commit 2c94a557 authored by Tristan Cavelier's avatar Tristan Cavelier

erp5_officejs: use loopEventListener on echarts gadget

parent f2fc4d73
......@@ -112,9 +112,10 @@
<item>
<key> <string>text_content</string> </key>
<value> <string>CACHE MANIFEST\n
# v1.0.0\n
# v1.1.0\n
CACHE:\n
gadget_field_graph_echarts.html/echarts-all.js\n
gadget_field_graph_echarts.html/gadget_global.js\n
gadget_field_graph_echarts.html/renderjs.js\n
gadget_field_graph_echarts.html/rsvp.js\n
gadget_field_graph_echarts.html/unsafe/gadget_field_graph_echarts.js\n
......
......@@ -18,6 +18,7 @@
<script src="echarts-all.js" type="text/javascript"></script>
<!-- custom script -->
<script src="gadget_global.js" type="text/javascript"></script>
<script src="unsafe/gadget_field_graph_echarts.js" type="text/javascript"></script>
</head>
......
/*global window, rJS, RSVP, echarts */
/*global window, rJS, RSVP, echarts, loopEventListener */
/*jslint nomen: true, indent: 2 */
(function (window, rJS, RSVP, echarts) {
(function (window, rJS, RSVP, echarts, loopEventListener) {
"use strict";
/////////////////////////////////////////////////////////////////
......@@ -174,13 +174,15 @@
chart.setOption(graph_data_and_parameter);
this.listenToClickEventOnTheChart(chart);
// XXX
window.addEventListener("resize", function () {
chart.resize();
}, {passive: true});
gadget.property_dict.chart = chart;
})
.declareService(function () {
var gadget = this;
return loopEventListener(window, "resize", {passive: true}, function () {
gadget.property_dict.chart.resize();
}, false);
})
.declareJob('listenToClickEventOnTheChart', function (chart) {
var gadget = this,
defer = RSVP.defer();
......@@ -191,4 +193,4 @@
});
return defer.promise;
});
}(window, rJS, RSVP, echarts));
\ No newline at end of file
}(window, rJS, RSVP, echarts, loopEventListener));
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment