Skip to content

Commit 32d96cb

Browse files
committed
[build] 0.9.1
close #82 close #81
1 parent c1c61ca commit 32d96cb

File tree

9 files changed

+141
-72
lines changed

9 files changed

+141
-72
lines changed

bundle-size/common.html

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

bundle-size/es.html

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

bundle-size/min.html

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

bundle-size/umd.html

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

lib/index.browser.js

Lines changed: 33 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
/**
3-
* chimee v0.9.0
3+
* chimee v0.9.1
44
* (c) 2017-2018 toxic-johann
55
* Released under MIT
66
*/
@@ -344,7 +344,7 @@ var _objectGpo = Object.getPrototypeOf || function (O) {
344344

345345

346346
_objectSap('getPrototypeOf', function () {
347-
return function getPrototypeOf$$1(it) {
347+
return function getPrototypeOf(it) {
348348
return _objectGpo(_toObject(it));
349349
};
350350
});
@@ -8482,7 +8482,7 @@ var Plugin = (_dec$3 = autobindClass(), _dec$3(_class$3 = function (_VideoWrappe
84828482
var _this = _possibleConstructorReturn(this, (Plugin.__proto__ || _Object$getPrototypeOf(Plugin)).call(this));
84838483

84848484
_this.destroyed = false;
8485-
_this.VERSION = '0.9.0';
8485+
_this.VERSION = '0.9.1';
84868486
_this.__operable = true;
84878487
_this.__level = 0;
84888488

@@ -9164,7 +9164,9 @@ var Dom = (_dec$5 = waituntil('__dispatcher.videoConfigReady'), _dec2$4 = before
91649164
_createClass(Dom, [{
91659165
key: 'installVideo',
91669166
value: function installVideo(videoElement) {
9167-
var _this2 = this;
9167+
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
9168+
_ref$bindEvent = _ref.bindEvent,
9169+
bindEvent = _ref$bindEvent === undefined ? true : _ref$bindEvent;
91689170

91699171
this.__videoExtendedNodes.push(videoElement);
91709172
setAttr(videoElement, 'tabindex', -1);
@@ -9189,6 +9191,15 @@ var Dom = (_dec$5 = waituntil('__dispatcher.videoConfigReady'), _dec2$4 = before
91899191
if (this.container.parentElement !== this.wrapper) {
91909192
$(this.wrapper).append(this.container);
91919193
}
9194+
if (bindEvent) this.bindVideoEvents(videoElement);
9195+
this.videoElement = videoElement;
9196+
return videoElement;
9197+
}
9198+
}, {
9199+
key: 'bindVideoEvents',
9200+
value: function bindVideoEvents(videoElement) {
9201+
var _this2 = this;
9202+
91929203
videoEvents.forEach(function (key) {
91939204
var fn = function fn() {
91949205
var _dispatcher$bus3;
@@ -9205,8 +9216,6 @@ var Dom = (_dec$5 = waituntil('__dispatcher.videoConfigReady'), _dec2$4 = before
92059216
this._addDomEvents(videoElement, this.videoDomEventHandlerList, function (key) {
92069217
return _this2._getEventHandler(key, { penetrate: true });
92079218
});
9208-
this.videoElement = videoElement;
9209-
return videoElement;
92109219
}
92119220
}, {
92129221
key: 'removeVideo',
@@ -9473,10 +9482,10 @@ var Dom = (_dec$5 = waituntil('__dispatcher.videoConfigReady'), _dec2$4 = before
94739482

94749483
}, {
94759484
key: '_getEventHandler',
9476-
value: function _getEventHandler(key, _ref) {
9485+
value: function _getEventHandler(key, _ref2) {
94779486
var _this8 = this;
94789487

9479-
var penetrate = _ref.penetrate;
9488+
var penetrate = _ref2.penetrate;
94809489

94819490
if (!penetrate || ['mouseenter', 'mouseleave'].indexOf(key) < 0) {
94829491
return function () {
@@ -10000,7 +10009,7 @@ var Dispatcher = (_dec$6 = before(convertNameIntoId), _dec2$5 = before(checkPlug
1000010009
var oldKernel = this.kernel;
1000110010
var originVideoConfig = deepClone(this.videoConfig);
1000210011
this.dom.removeVideo();
10003-
this.dom.installVideo(video);
10012+
this.dom.installVideo(video, { bindEvent: false });
1000410013
// as we will reset the currentVideoConfig on the new video
1000510014
// it will trigger the watch function as they maybe differnet
1000610015
// because video config will return the real situation
@@ -10025,6 +10034,11 @@ var Dispatcher = (_dec$6 = before(convertNameIntoId), _dec2$5 = before(checkPlug
1002510034
_Object$assign(this.videoConfig, { isLive: isLive, box: box, preset: preset, kernels: kernels });
1002610035
// const config = {}
1002710036
oldKernel.destroy();
10037+
// delay video event binding
10038+
// so that people can't feel the default value change
10039+
setTimeout(function () {
10040+
return _this3.dom.bindVideoEvents(video);
10041+
});
1002810042
}
1002910043
/**
1003010044
* destroy function called when dispatcher destroyed
@@ -10535,6 +10549,15 @@ var Chimee = (_dec$7 = autobindClass(), _dec$7(_class$8 = (_class2$2 = (_temp =
1053510549
value: function destroy() {
1053610550
_get(Chimee.prototype.__proto__ || _Object$getPrototypeOf(Chimee.prototype), '__destroy', this).call(this);
1053710551
this.__dispatcher.destroy();
10552+
// $FlowFixMe: normal obejct define
10553+
Object.defineProperty(this, '__dispatcher', {
10554+
get: function get$$1() {
10555+
throw new Error('This instance has been destroyed.');
10556+
},
10557+
10558+
enumerable: true,
10559+
configurable: true
10560+
});
1053810561
this.destroyed = true;
1053910562
}
1054010563
}, {
@@ -10567,7 +10590,7 @@ var Chimee = (_dec$7 = autobindClass(), _dec$7(_class$8 = (_class2$2 = (_temp =
1056710590
}), _descriptor2$1 = _applyDecoratedDescriptor$7(_class2$2.prototype, 'version', [frozen], {
1056810591
enumerable: true,
1056910592
initializer: function initializer() {
10570-
return '0.9.0';
10593+
return '0.9.1';
1057110594
}
1057210595
}), _descriptor3$1 = _applyDecoratedDescriptor$7(_class2$2.prototype, 'config', [frozen], {
1057310596
enumerable: true,

lib/index.js

Lines changed: 57 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
/**
3-
* chimee v0.9.0
3+
* chimee v0.9.1
44
* (c) 2017-2018 toxic-johann
55
* Released under MIT
66
*/
@@ -9,29 +9,29 @@
99

1010
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
1111

12-
var _Object$defineProperty = _interopDefault(require('babel-runtime/core-js/object/define-property'));
1312
var _Object$getOwnPropertyDescriptor = _interopDefault(require('babel-runtime/core-js/object/get-own-property-descriptor'));
14-
var _Object$getPrototypeOf = _interopDefault(require('babel-runtime/core-js/object/get-prototype-of'));
13+
var _Map = _interopDefault(require('babel-runtime/core-js/map'));
14+
var _toConsumableArray = _interopDefault(require('babel-runtime/helpers/toConsumableArray'));
15+
var _Promise = _interopDefault(require('babel-runtime/core-js/promise'));
1516
var _classCallCheck = _interopDefault(require('babel-runtime/helpers/classCallCheck'));
1617
var _createClass = _interopDefault(require('babel-runtime/helpers/createClass'));
18+
var chimeeHelper = require('chimee-helper');
19+
var toxicDecorators = require('toxic-decorators');
20+
var _Object$defineProperty = _interopDefault(require('babel-runtime/core-js/object/define-property'));
21+
var _Number$isNaN = _interopDefault(require('babel-runtime/core-js/number/is-nan'));
22+
var _Object$keys = _interopDefault(require('babel-runtime/core-js/object/keys'));
23+
var _JSON$stringify = _interopDefault(require('babel-runtime/core-js/json/stringify'));
24+
var _defineProperty = _interopDefault(require('babel-runtime/helpers/defineProperty'));
25+
var _typeof = _interopDefault(require('babel-runtime/helpers/typeof'));
26+
var _Object$getPrototypeOf = _interopDefault(require('babel-runtime/core-js/object/get-prototype-of'));
1727
var _possibleConstructorReturn = _interopDefault(require('babel-runtime/helpers/possibleConstructorReturn'));
1828
var _get = _interopDefault(require('babel-runtime/helpers/get'));
1929
var _inherits = _interopDefault(require('babel-runtime/helpers/inherits'));
20-
var _toConsumableArray = _interopDefault(require('babel-runtime/helpers/toConsumableArray'));
30+
var esFullscreen = _interopDefault(require('es-fullscreen'));
2131
var _slicedToArray = _interopDefault(require('babel-runtime/helpers/slicedToArray'));
2232
var _Object$entries = _interopDefault(require('babel-runtime/core-js/object/entries'));
2333
var _Object$assign = _interopDefault(require('babel-runtime/core-js/object/assign'));
24-
var _Promise = _interopDefault(require('babel-runtime/core-js/promise'));
25-
var _typeof = _interopDefault(require('babel-runtime/helpers/typeof'));
26-
var chimeeHelper = require('chimee-helper');
2734
var ChimeeKernel = _interopDefault(require('chimee-kernel'));
28-
var _Map = _interopDefault(require('babel-runtime/core-js/map'));
29-
var toxicDecorators = require('toxic-decorators');
30-
var _Object$keys = _interopDefault(require('babel-runtime/core-js/object/keys'));
31-
var _JSON$stringify = _interopDefault(require('babel-runtime/core-js/json/stringify'));
32-
var _defineProperty = _interopDefault(require('babel-runtime/helpers/defineProperty'));
33-
var _Number$isNaN = _interopDefault(require('babel-runtime/core-js/number/is-nan'));
34-
var esFullscreen = _interopDefault(require('es-fullscreen'));
3535

3636
var videoEvents = ['abort', 'canplay', 'canplaythrough', 'durationchange', 'emptied', 'encrypted', 'ended', 'error', 'interruptbegin', 'interruptend', 'loadeddata', 'loadedmetadata', 'loadstart', 'mozaudioavailable', 'pause', 'play', 'playing', 'progress', 'ratechange', 'seeked', 'seeking', 'stalled', 'suspend', 'timeupdate', 'volumechange', 'waiting'];
3737
var videoReadOnlyProperties = ['buffered', 'currentSrc', 'duration', 'error', 'ended', 'networkState', 'paused', 'readyState', 'seekable', 'sinkId', 'controlsList', 'tabIndex', 'dataset', 'offsetHeight', 'offsetLeft', 'offsetParent', 'offsetTop', 'offsetWidth'];
@@ -622,15 +622,15 @@ function accessorVideoAttribute(attribute) {
622622
},
623623
_set = _ref.set,
624624
_get$$1 = _ref.get,
625-
isBoolean$$1 = _ref.isBoolean;
625+
isBoolean = _ref.isBoolean;
626626

627627
return toxicDecorators.accessor({
628628
get: function get(value) {
629629
return this.dispatcher.videoConfigReady && this.inited ? this.dom.videoElement[_get$$1] : value;
630630
},
631631
set: function set(value) {
632632
if (!this.dispatcher.videoConfigReady) return value;
633-
var val = isBoolean$$1 ? value ? '' : undefined
633+
var val = isBoolean ? value ? '' : undefined
634634
/* istanbul ignore next */
635635
: value === null ? undefined : value;
636636
this.dom.setAttr('video', _set, val);
@@ -641,15 +641,15 @@ function accessorVideoAttribute(attribute) {
641641
});
642642
}
643643

644-
function accessorCustomAttribute(attribute, isBoolean$$1) {
644+
function accessorCustomAttribute(attribute, isBoolean) {
645645
return toxicDecorators.accessor({
646646
get: function get(value) {
647647
var attrValue = this.dom.getAttr('video', attribute);
648-
return this.dispatcher.videoConfigReady && this.inited ? isBoolean$$1 ? !!attrValue : attrValue : value;
648+
return this.dispatcher.videoConfigReady && this.inited ? isBoolean ? !!attrValue : attrValue : value;
649649
},
650650
set: function set(value) {
651651
if (!this.dispatcher.videoConfigReady) return value;
652-
var val = isBoolean$$1 ? value || undefined : value === null ? undefined : value;
652+
var val = isBoolean ? value || undefined : value === null ? undefined : value;
653653
this.dom.setAttr('video', attribute, val);
654654
return value;
655655
}
@@ -1462,7 +1462,7 @@ var Plugin = (_dec$3 = toxicDecorators.autobindClass(), _dec$3(_class$3 = functi
14621462
var _this = _possibleConstructorReturn(this, (Plugin.__proto__ || _Object$getPrototypeOf(Plugin)).call(this));
14631463

14641464
_this.destroyed = false;
1465-
_this.VERSION = '0.9.0';
1465+
_this.VERSION = '0.9.1';
14661466
_this.__operable = true;
14671467
_this.__level = 0;
14681468

@@ -1860,7 +1860,9 @@ var Dom = (_dec$4 = toxicDecorators.waituntil('__dispatcher.videoConfigReady'),
18601860
_createClass(Dom, [{
18611861
key: 'installVideo',
18621862
value: function installVideo(videoElement) {
1863-
var _this2 = this;
1863+
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
1864+
_ref$bindEvent = _ref.bindEvent,
1865+
bindEvent = _ref$bindEvent === undefined ? true : _ref$bindEvent;
18641866

18651867
this.__videoExtendedNodes.push(videoElement);
18661868
chimeeHelper.setAttr(videoElement, 'tabindex', -1);
@@ -1885,6 +1887,15 @@ var Dom = (_dec$4 = toxicDecorators.waituntil('__dispatcher.videoConfigReady'),
18851887
if (this.container.parentElement !== this.wrapper) {
18861888
chimeeHelper.$(this.wrapper).append(this.container);
18871889
}
1890+
if (bindEvent) this.bindVideoEvents(videoElement);
1891+
this.videoElement = videoElement;
1892+
return videoElement;
1893+
}
1894+
}, {
1895+
key: 'bindVideoEvents',
1896+
value: function bindVideoEvents(videoElement) {
1897+
var _this2 = this;
1898+
18881899
videoEvents.forEach(function (key) {
18891900
var fn = function fn() {
18901901
var _dispatcher$bus3;
@@ -1901,8 +1912,6 @@ var Dom = (_dec$4 = toxicDecorators.waituntil('__dispatcher.videoConfigReady'),
19011912
this._addDomEvents(videoElement, this.videoDomEventHandlerList, function (key) {
19021913
return _this2._getEventHandler(key, { penetrate: true });
19031914
});
1904-
this.videoElement = videoElement;
1905-
return videoElement;
19061915
}
19071916
}, {
19081917
key: 'removeVideo',
@@ -2040,25 +2049,25 @@ var Dom = (_dec$4 = toxicDecorators.waituntil('__dispatcher.videoConfigReady'),
20402049

20412050
}, {
20422051
key: 'setAttr',
2043-
value: function setAttr$$1(target, attr, val) {
2052+
value: function setAttr(target, attr, val) {
20442053
// $FlowFixMe: flow do not support computed property/element on class, which is silly here.
20452054
chimeeHelper.setAttr(this[target], attr, val);
20462055
}
20472056
}, {
20482057
key: 'getAttr',
2049-
value: function getAttr$$1(target, attr) {
2058+
value: function getAttr(target, attr) {
20502059
// $FlowFixMe: flow do not support computed property/element on class, which is silly here.
20512060
return chimeeHelper.getAttr(this[target], attr);
20522061
}
20532062
}, {
20542063
key: 'setStyle',
2055-
value: function setStyle$$1(target, attr, val) {
2064+
value: function setStyle(target, attr, val) {
20562065
// $FlowFixMe: flow do not support computed property/element on class, which is silly here.
20572066
chimeeHelper.setStyle(this[target], attr, val);
20582067
}
20592068
}, {
20602069
key: 'getStyle',
2061-
value: function getStyle$$1(target, attr) {
2070+
value: function getStyle(target, attr) {
20622071
// $FlowFixMe: flow do not support computed property/element on class, which is silly here.
20632072
return chimeeHelper.getStyle(this[target], attr);
20642073
}
@@ -2169,10 +2178,10 @@ var Dom = (_dec$4 = toxicDecorators.waituntil('__dispatcher.videoConfigReady'),
21692178

21702179
}, {
21712180
key: '_getEventHandler',
2172-
value: function _getEventHandler(key, _ref) {
2181+
value: function _getEventHandler(key, _ref2) {
21732182
var _this8 = this;
21742183

2175-
var penetrate = _ref.penetrate;
2184+
var penetrate = _ref2.penetrate;
21762185

21772186
if (!penetrate || ['mouseenter', 'mouseleave'].indexOf(key) < 0) {
21782187
return function () {
@@ -2449,12 +2458,12 @@ var Dispatcher = (_dec$5 = toxicDecorators.before(convertNameIntoId), _dec2$4 =
24492458
if (!chimeeHelper.isString(option.alias)) option.alias = undefined;
24502459
var _option = option,
24512460
name = _option.name,
2452-
alias$$1 = _option.alias;
2461+
alias = _option.alias;
24532462

2454-
option.name = alias$$1 || name;
2463+
option.name = alias || name;
24552464
delete option.alias;
24562465
var key = chimeeHelper.camelize(name);
2457-
var id = chimeeHelper.camelize(alias$$1 || name);
2466+
var id = chimeeHelper.camelize(alias || name);
24582467
var pluginOption = option;
24592468
var pluginConfig = Dispatcher.getPluginConfig(key);
24602469
if (chimeeHelper.isEmpty(pluginConfig)) throw new TypeError('You have not installed plugin ' + key);
@@ -2696,7 +2705,7 @@ var Dispatcher = (_dec$5 = toxicDecorators.before(convertNameIntoId), _dec2$4 =
26962705
var oldKernel = this.kernel;
26972706
var originVideoConfig = chimeeHelper.deepClone(this.videoConfig);
26982707
this.dom.removeVideo();
2699-
this.dom.installVideo(video);
2708+
this.dom.installVideo(video, { bindEvent: false });
27002709
// as we will reset the currentVideoConfig on the new video
27012710
// it will trigger the watch function as they maybe differnet
27022711
// because video config will return the real situation
@@ -2721,6 +2730,11 @@ var Dispatcher = (_dec$5 = toxicDecorators.before(convertNameIntoId), _dec2$4 =
27212730
_Object$assign(this.videoConfig, { isLive: isLive, box: box, preset: preset, kernels: kernels });
27222731
// const config = {}
27232732
oldKernel.destroy();
2733+
// delay video event binding
2734+
// so that people can't feel the default value change
2735+
setTimeout(function () {
2736+
return _this3.dom.bindVideoEvents(video);
2737+
});
27242738
}
27252739
/**
27262740
* destroy function called when dispatcher destroyed
@@ -3231,6 +3245,15 @@ var Chimee = (_dec$6 = toxicDecorators.autobindClass(), _dec$6(_class$7 = (_clas
32313245
value: function destroy() {
32323246
_get(Chimee.prototype.__proto__ || _Object$getPrototypeOf(Chimee.prototype), '__destroy', this).call(this);
32333247
this.__dispatcher.destroy();
3248+
// $FlowFixMe: normal obejct define
3249+
Object.defineProperty(this, '__dispatcher', {
3250+
get: function get() {
3251+
throw new Error('This instance has been destroyed.');
3252+
},
3253+
3254+
enumerable: true,
3255+
configurable: true
3256+
});
32343257
this.destroyed = true;
32353258
}
32363259
}, {
@@ -3263,7 +3286,7 @@ var Chimee = (_dec$6 = toxicDecorators.autobindClass(), _dec$6(_class$7 = (_clas
32633286
}), _descriptor2$1 = _applyDecoratedDescriptor$6(_class2$1.prototype, 'version', [toxicDecorators.frozen], {
32643287
enumerable: true,
32653288
initializer: function initializer() {
3266-
return '0.9.0';
3289+
return '0.9.1';
32673290
}
32683291
}), _descriptor3$1 = _applyDecoratedDescriptor$6(_class2$1.prototype, 'config', [toxicDecorators.frozen], {
32693292
enumerable: true,

lib/index.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)