Skip to content

Commit

Permalink
fix: 修复数据传递中的 function 字段
Browse files Browse the repository at this point in the history
  • Loading branch information
lyxuncle committed Sep 25, 2019
1 parent 3049ed0 commit da13ace
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 8 deletions.
4 changes: 2 additions & 2 deletions dist/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
<meta name="format-detection" content="telephone=no">
<title>demo</title>

<link href="//storage.jd.com/ambient/styles-sina_wave.css?201b6681548d103020e8" rel="stylesheet"></head>
<link href="//storage.jd.com/ambient/styles-sina_wave.css?796da4325969e6470518" rel="stylesheet"></head>
<body>
<!-- S 主体内容 -->
<div class="o2team_ambient_main">
<canvas id="sinewaves"></canvas>
</div>
<!-- E 主体内容 -->

<script type="text/javascript" src="//storage.jd.com/ambient/control-sina_wave.js?201b6681548d103020e8"></script><script type="text/javascript" src="//storage.jd.com/ambient/bundle-sina_wave.js?201b6681548d103020e8"></script><script type="text/javascript" src="//storage.jd.com/ambient/config-sina_wave.js?201b6681548d103020e8"></script></body>
<script type="text/javascript" src="//storage.jd.com/ambient/control-sina_wave.js?796da4325969e6470518"></script><script type="text/javascript" src="//storage.jd.com/ambient/bundle-sina_wave.js?796da4325969e6470518"></script><script type="text/javascript" src="//storage.jd.com/ambient/config-sina_wave.js?796da4325969e6470518"></script></body>
</html>
4 changes: 2 additions & 2 deletions dist/index_demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<script type="text/javascript" src="//storage.jd.com/ambient-global/ambient-autoStop-head.js"></script>

<link href="//storage.jd.com/ambient/styles-sina_wave.css?201b6681548d103020e8" rel="stylesheet"></head>
<link href="//storage.jd.com/ambient/styles-sina_wave.css?796da4325969e6470518" rel="stylesheet"></head>
<body>
<!-- S 主体内容 -->
<div class="o2team_ambient_main">
Expand All @@ -18,5 +18,5 @@

<script type="text/javascript" src="//storage.jd.com/ambient-global/ambient-autoStop-body.js"></script>

<script type="text/javascript" src="//storage.jd.com/ambient/control-sina_wave.js?201b6681548d103020e8"></script><script type="text/javascript" src="//storage.jd.com/ambient/bundle-sina_wave.js?201b6681548d103020e8"></script><script type="text/javascript" src="//storage.jd.com/ambient/config-sina_wave.js?201b6681548d103020e8"></script></body>
<script type="text/javascript" src="//storage.jd.com/ambient/control-sina_wave.js?796da4325969e6470518"></script><script type="text/javascript" src="//storage.jd.com/ambient/bundle-sina_wave.js?796da4325969e6470518"></script><script type="text/javascript" src="//storage.jd.com/ambient/config-sina_wave.js?796da4325969e6470518"></script></body>
</html>
6 changes: 3 additions & 3 deletions info.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
"title": "sina_wave",
"ambName": "波浪",
"github": "https://github.com/o2team-ambient/sina_wave",
"demoSnippet": "<link href=\"//storage.jd.com/ambient/styles-sina_wave.css?t=1568725365000\" rel=\"stylesheet\"></link><!-- S 主体内容 -->\n <div class=\"o2team_ambient_main\">\n <canvas id=\"sinewaves\"></canvas>\n </div>\n <!-- E 主体内容 --><script src=\"//storage.jd.com/ambient/bundle-sina_wave.js?t=1568725365000\"></script>",
"controlUrl": "//storage.jd.com/ambient/control-sina_wave.js?t=1568725365000",
"configUrl": "//storage.jd.com/ambient/config-sina_wave.js?t=1568725365000",
"demoSnippet": "<link href=\"//storage.jd.com/ambient/styles-sina_wave.css?t=1569398853000\" rel=\"stylesheet\"></link><!-- S 主体内容 -->\n <div class=\"o2team_ambient_main\">\n <canvas id=\"sinewaves\"></canvas>\n </div>\n <!-- E 主体内容 --><script src=\"//storage.jd.com/ambient/bundle-sina_wave.js?t=1569398853000\"></script>",
"controlUrl": "//storage.jd.com/ambient/control-sina_wave.js?t=1569398853000",
"configUrl": "//storage.jd.com/ambient/config-sina_wave.js?t=1569398853000",
"placeholderImg": "//storage.jd.com/ambient/sina_wave_placeholder.png?t=1554260508000",
"gifImg": "//storage.jd.com/ambient/sina_wave_motion.gif?t=1553781489000",
"spriteImg": "//storage.jd.com/ambient/sina_wave_sprite.png?t=1554260508000"
Expand Down
6 changes: 5 additions & 1 deletion src/js/sina_wave.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ class SineWaves {
this.isPlay = true

let extendsObj = {}
let wavesArr = waves.map(item => {
return {...item}
})

if (initialize) {
extendsObj.initialize = () => {
typeof initialize === 'function' && initialize()
Expand Down Expand Up @@ -81,7 +85,7 @@ class SineWaves {
wavesWidth: `${wavesWidth}%`,

// An array of wave options
waves
waves: wavesArr
})
}

Expand Down
6 changes: 6 additions & 0 deletions src/js/utils/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,12 @@ class Controller {
// 传送数据
transMsg (dom) {
let transWin = dom.contentWindow
window[O2_AMBIENT_CONFIG].waves = window[O2_AMBIENT_CONFIG].waves.map(item => {
return {
...item,
random: null
}
})
transWin.postMessage({
type: 'reset',
data: window[O2_AMBIENT_CONFIG]
Expand Down

0 comments on commit da13ace

Please sign in to comment.