Skip to content

Commit

Permalink
[update] update chimee-kernel to 1.3.2
Browse files Browse the repository at this point in the history
  • Loading branch information
toxic-johann committed Dec 17, 2017
1 parent f8b5086 commit c38c2e6
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 136 deletions.
2 changes: 2 additions & 0 deletions .flowconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
.*/src/.*
[libs]
flow
node_modules/chimee-helper/lib/index.flow.js
node_modules/chimee-kernel/lib/index.flow.js
[lints]
all=warn
untyped-type-import=error
Expand Down
2 changes: 1 addition & 1 deletion flow/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import type Dispatcher from 'dispatcher/index';
import type Bus from 'dispatcher/bus';
import type Dom from 'dispatcher/dom';
import type Chimee from '../src/index';
import type Kernel from 'kernel/index';
import type VideoConfig from 'dispatcher/video-config';
import type VideoWrapper from 'dispatcher/video-wrapper';
import type GlobalConfig from 'global/config';
import type ChimeeKernel from 'chimee-kernel';
declare type PluginConfig = {
id: string,
name: string,
Expand Down
127 changes: 1 addition & 126 deletions flow/module.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import { CustEvent } from 'chimee-helper';
declare module 'toxic-decorators' {
declare module.exports: any;
}
declare module 'chimee-kernel' {
declare module.exports: any;
}

declare module 'es-fullscreen' {
declare module.exports: {
Expand All @@ -28,126 +26,3 @@ declare module 'es-fullscreen' {
_dispatchEvent (element: Element): void;
}
}

declare module 'chimee-helper' {
declare export function genTraversalHandler (fn: Function): Function;
declare export function deepClone<T: Object | Array<any>> (source: T): T;
declare export function deepAssign<T: any> (...args: Array<T>): T & T;
declare export function camelize (str: string, isBig: ?boolean): string;
declare export function hypenate (str: string): string;
declare export function bind (fn: Function, context: any): Function;
declare export function getDeepProperty (obj: any, keys: string | Array<string>, option?: {throwError?: boolean, backup?: any}): any;

declare export function defined (val: any): boolean %checks(typeof val !== 'undefined');
declare export function isVoid (val: void | null): true;
declare export function isVoid (val: any): false;
declare export function isArray (val: any): boolean %checks(Array.isArray(val));
declare export function isFunction (val: any): boolean %checks(typeof val === 'function');
declare export function isObject (val: any): boolean %checks(typeof val === 'object' && val !== null);
declare export function isNumber (val: any): boolean %checks(typeof val === 'number');
declare export function isNumeric (val: any): boolean %checks(typeof val === 'number');
declare export function isInteger (val: any): boolean %checks(typeof val === 'number');
declare export function isEmpty (val: void | null | false | {||}): true;
declare export function isEmpty (val: any): false;
declare export function isEvent (val: any): boolean %checks(val instanceof Event);
declare export function isBlob (val: any): boolean %checks(val instanceof Blob);
declare export function isFile (val: Blob): boolean;
declare export function isFile (val: any): false;
declare export function isDate (val: any): boolean %checks(val instanceof Date);
declare export function isString (val: any): boolean %checks(typeof val === 'string');
declare export function isBoolean (val: any): boolean %checks(typeof val === 'boolean');
declare export function isPromise (val: Promise<*>): true;
declare export function isPromise (val: any): false;
declare export function isPrimitive (val: void | number | string | boolean): false;
declare export function isPrimitive (val: any): false;
declare export function isUrl (val: string): boolean;
declare export function isNode (val: any): boolean %checks(val instanceof Node);
declare export function isElement (val: any): boolean %checks(val instanceof HTMLElement);
declare export function isChildNode (parent: Node, child: Node): boolean;
declare export function isPosterityNode (parent: Node, child: Node): boolean;
declare export function isHTMLString (val: string): boolean;
declare export function isError (val: any): boolean %checks(val instanceof Error);

declare export function makeArray (obj: any): Array<any>;
declare export function transObjectAttrIntoArray (obj: Object, fn?: Function): Array<string>;
declare export function runRejectableQueue (queue: Array<any>, ...args: any): Promise<*>;
declare export function runStoppableQueue (queue: Array<any>, ...args: any): boolean;
declare export function setFrozenAttr (obj: Object, key: string, value: any): void;
declare export function setAttrGetterAndSetter (obj: Object, key: string, option: {get?: Function, set?: Function}, prefix: string): void;
declare export function decodeUTF8 (uint8array: any): string;
declare export function debounce (func: Function, wait: number, immediate: boolean): Function;
declare export function throttle (func: Function, wait: number, options: any, cxt: any): Function;
declare export function strRepeat (num: any, bit: number): string;
declare export function formatTime (time: number): string;
declare export function addTransMethod (obj: Object): Function;
declare export function appendCSS (cssText: string): HTMLElement;
declare export function formatDate (date: Date, pattern: string): string;
declare export function getLocalStorage (key: string): string | null | void;
declare export function setLocalStorage (key: string, val: string): void;

declare export function getAttr (el: Node, attrName: string): string | null;
declare export function setAttr (el: Node, attrName: string, attrVa: any): void;
declare export function addClassName (el: Node, cls: string): void;
declare export function removeClassName (el: Node, cls: string): void;
declare export function hasClassName (el: Node, cls: string): boolean;
declare export function removeEvent (el: Node, type: string, handler: Function, once?: boolean, capture?: boolean): void;
declare export function addEvent (el: Node, type: string, handler: Function, once?: boolean, capture?: boolean | Object): void;
declare export function addDelegate (el: Node, selector: string, type: string, handler: Function, capture: boolean): void;
declare export function removeDelegate (el: Node, selector: string, type: string, handler: Function, capture: boolean): void;
declare export function getStyle (el: Node, key: string): string;
declare export function setStyle (el: Node, key: string | Object, val?: string | number): void;
declare export function query (selector: string, container?: Node, toArray: boolean): Array<Node>;
declare export function removeEl (el: Node): void;
declare export function findParents (el: Node, endEl?: Node, haveEl: boolean, haveEndEl: boolean): Array<Node>;

declare export class NodeWrap {
each (...args: Array<Function>): NodeWrap;
push (...args: Array<Node>): NodeWrap;
splice (start: number, count: number): NodeWrap;
find (selector: string): NodeWrap;
append (childEls: Node): NodeWrap;
appendTo (childEls: Node): NodeWrap;
text (val: string): NodeWrap;
html (html: string): NodeWrap;
attr (name: string, val: string | number | boolean): NodeWrap;
data (key: string, val?: string | number | boolean | void): NodeWrap;
css (key: string, val?: string): NodeWrap;
addClass (cls: string): NodeWrap;
removeClass (cls: string): NodeWrap;
hasClass (cls: string): NodeWrap;
on (type: string, handler: Function, once?: boolean, capture?: boolean): NodeWrap;
off (type: string, handler: Function, once?: boolean, capture?: boolean): NodeWrap;
delegate (selector: string, type: string, handler: Function, capture: boolean): NodeWrap;
undelegate (selector: string, type: string, handler: Function, capture: boolean): NodeWrap;
remove (): NodeWrap;
}
declare export function $ (selector: string | Node, container?: Node): NodeWrap;

declare export class Log {
static GLOBAL_TAG: string;
static FORCE_GLOBAL_TAG: boolean;
static ENABLE_ERROR: boolean;
static ENABLE_INFO: boolean;
static ENABLE_WARN: boolean;
static ENABLE_DEBUG: boolean;
static ENABLE_VERBOSE: boolean;
static error (tag: string, msg?: string): void;
static warn (tag: string, msg?: string): void;
static info (tag: string, msg?: string): void;
static debug (tag: string, msg?: string): void;
static verbose (tag: string, msg?: string): void;
}


declare export class UAParser {
getBrowser (): Object;
getDevice (): Object;
getEngine (): Object;
getOS (): Object;
getCPU (): Object;
getResult (): Object;
getUA (): Object;
setUA (): Object;
}

}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@
"homepage": "https://github.com/Chimeejs/chimee#readme",
"dependencies": {
"babel-runtime": "^6.26.0",
"chimee-helper": "^0.2.9",
"chimee-kernel": "^1.3.0",
"chimee-helper": "^0.2.10",
"es-fullscreen": "^0.2.1",
"toxic-decorators": "^0.3.8"
},
Expand All @@ -61,6 +60,7 @@
"babel-preset-es2015-rollup": "^3.0.0",
"babel-preset-flow": "^6.23.0",
"babel-preset-stage-0": "^6.24.1",
"chimee-kernel": "^1.3.2",
"chimee-kernel-flv": "^1.3.0",
"chimee-kernel-hls": "^1.0.7",
"chimee-plugin-center-state": "0.0.8",
Expand Down
12 changes: 6 additions & 6 deletions src/dispatcher/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @flow
import { isString, camelize, deepAssign, isObject, isEmpty, isArray, isFunction, transObjectAttrIntoArray, isPromise, Log, runRejectableQueue, addEvent, removeEvent, isError, deepClone } from 'chimee-helper';
import Kernel from 'chimee-kernel';
import ChimeeKernel from 'chimee-kernel';
import Bus from './bus';
import Plugin from './plugin';
import Dom from './dom';
Expand Down Expand Up @@ -37,7 +37,7 @@ export default class Dispatcher {
plugins: plugins;
bus: Bus;
order: Array<string>;
kernel: Kernel;
kernel: ChimeeKernel;
dom: Dom;
vm: Chimee;
ready: Promise<*>;
Expand All @@ -48,7 +48,7 @@ export default class Dispatcher {
zIndexMap: Object;
changeWatchable: boolean;
kernelEventHandlerList: Array<Function>;
_silentLoadTempKernel: Kernel;
_silentLoadTempKernel: ChimeeKernel | void;
/**
* all plugins instance set
* @type {Object}
Expand Down Expand Up @@ -408,7 +408,7 @@ export default class Dispatcher {
}
switchKernel({ video, kernel, config }: {
video: HTMLVideoElement,
kernel: Kernel,
kernel: ChimeeKernel,
config: {
src: string,
isLive: boolean,
Expand Down Expand Up @@ -608,10 +608,10 @@ export default class Dispatcher {
}
config.preset = Object.assign(newPreset, preset);
config.presetConfig = presetConfig;
const kernel = new Kernel(video, config);
const kernel = new ChimeeKernel(video, config);
return kernel;
}
_bindKernelEvents(kernel: Kernel, remove?: boolean = false) {
_bindKernelEvents(kernel: ChimeeKernel, remove?: boolean = false) {
kernelEvents.forEach((key, index) => {
if (!remove) {
const fn = (...args: any) => this.bus.triggerSync(key, ...args);
Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import GlobalConfig from 'config/global';
export default class Chimee extends VideoWrapper {
__id: string;
__dispatcher: Dispatcher;
__kernel: Kernel;
__kernel: ChimeeKernel;
__bus: Bus;
ready: Promise<*>;
readySync: boolean;
Expand Down

0 comments on commit c38c2e6

Please sign in to comment.