/
index.js
35 lines (32 loc) · 1.06 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import './index.scss';
import $ from 'jquery';
import microApp from 'micro-app';
// You can configure by `setAttribute`
microApp.setAttribute('capable', true);
// Invocation chaining is more clever and suggest to use `prop` instead of `attr`
// It will work in `Zepto` too
$(microApp).prop('status-bar-style', 'black-translucent').prop('title', 'Demo of jQuery');
// You can select the element if you like
// `jQuery` could sets many values at once
// `icon` and `splash` support multi value if type of the value is 'Array'
// `String` and `Object` are both allow in `Array` and each key-value in `Object` will be set on the tag
$('script[micro-app]').prop({
icon : [
{
href : 'icon.jpg',
sizes : '120x120',
},
{
href : 'icon.jpg',
sizes : '152x152',
},
],
splash : [
'splash.jpg',
{
href : 'splash.jpg',
media : '(device-width: 320px) and (device-height: 568px) and (-webkit-device-pixel-ratio: 2)',
data : 'something',
},
],
});