@antv/g-mobile
Advanced tools
Comparing version 0.0.3 to 0.0.5
@@ -7,3 +7,3 @@ import { __extends } from "tslib"; | ||
import { each, getPixelRatio } from './util/util'; | ||
import { requestAnimationFrame, clearAnimationFrame } from './util/time'; | ||
import { requestAnimationFrame, clearAnimationFrame, setExtraFunction } from './util/time'; | ||
import { applyAttrsToContext, drawChildren, getMergedRegion, mergeView, checkRefresh, clearChanged } from './util/draw'; | ||
@@ -21,2 +21,3 @@ import EventController from './events'; | ||
// TODO 这里会传递过来extra,里面包含一些来自各个平台的优化函数 | ||
setExtraFunction(_this.get('extra')); | ||
} | ||
@@ -23,0 +24,0 @@ else { |
@@ -1,4 +0,4 @@ | ||
/// <reference types="node" /> | ||
declare function requestAnimationFrame(fn: FrameRequestCallback): number | NodeJS.Timeout; | ||
declare function clearAnimationFrame(handler: number): void; | ||
export declare function setExtraFunction(extraData?: any): void; | ||
declare function requestAnimationFrame(fn: FrameRequestCallback): any; | ||
declare function clearAnimationFrame(handler: number): any; | ||
export { requestAnimationFrame, clearAnimationFrame }; |
@@ -0,2 +1,11 @@ | ||
var cache = {}; | ||
export function setExtraFunction(extraData) { | ||
if (extraData === void 0) { extraData = {}; } | ||
cache['requestAnimationFrame'] = extraData['requestAnimationFrame']; | ||
cache['clearAnimationFrame'] = extraData['clearAnimationFrame']; | ||
} | ||
function requestAnimationFrame(fn) { | ||
if (cache['requestAnimationFrame']) { | ||
return cache['requestAnimationFrame']; | ||
} | ||
var method = typeof window === 'object' && window.requestAnimationFrame | ||
@@ -10,2 +19,5 @@ ? window.requestAnimationFrame | ||
function clearAnimationFrame(handler) { | ||
if (cache['clearAnimationFrame']) { | ||
return cache['clearAnimationFrame']; | ||
} | ||
var method = typeof window === 'object' && window.cancelAnimationFrame ? window.cancelAnimationFrame : clearTimeout; | ||
@@ -12,0 +24,0 @@ return method(handler); |
@@ -28,4 +28,5 @@ export declare function getPixelRatio(): number; | ||
export declare function isSamePoint(point1: any, point2: any): boolean; | ||
export { isNil, isString, isFunction, isArray, each, toRadian, mod, isNumberEqual, requestAnimationFrame, clearAnimationFrame, } from '@antv/util'; | ||
export { isNil, isString, isFunction, isArray, each, toRadian, mod, isNumberEqual } from '@antv/util'; | ||
export { requestAnimationFrame, clearAnimationFrame } from './time'; | ||
export declare function tick(fn: FrameRequestCallback): void; | ||
export declare function isParent(container: any, shape: any): boolean; |
@@ -51,3 +51,4 @@ export function getPixelRatio() { | ||
} | ||
export { isNil, isString, isFunction, isArray, each, toRadian, mod, isNumberEqual, requestAnimationFrame, clearAnimationFrame, } from '@antv/util'; | ||
export { isNil, isString, isFunction, isArray, each, toRadian, mod, isNumberEqual } from '@antv/util'; | ||
export { requestAnimationFrame, clearAnimationFrame } from './time'; | ||
export function tick(fn) { | ||
@@ -54,0 +55,0 @@ if (window) { |
@@ -22,2 +22,3 @@ "use strict"; | ||
// TODO 这里会传递过来extra,里面包含一些来自各个平台的优化函数 | ||
time_1.setExtraFunction(_this.get('extra')); | ||
} | ||
@@ -24,0 +25,0 @@ else { |
@@ -1,4 +0,4 @@ | ||
/// <reference types="node" /> | ||
declare function requestAnimationFrame(fn: FrameRequestCallback): number | NodeJS.Timeout; | ||
declare function clearAnimationFrame(handler: number): void; | ||
export declare function setExtraFunction(extraData?: any): void; | ||
declare function requestAnimationFrame(fn: FrameRequestCallback): any; | ||
declare function clearAnimationFrame(handler: number): any; | ||
export { requestAnimationFrame, clearAnimationFrame }; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.clearAnimationFrame = exports.requestAnimationFrame = void 0; | ||
exports.clearAnimationFrame = exports.requestAnimationFrame = exports.setExtraFunction = void 0; | ||
var cache = {}; | ||
function setExtraFunction(extraData) { | ||
if (extraData === void 0) { extraData = {}; } | ||
cache['requestAnimationFrame'] = extraData['requestAnimationFrame']; | ||
cache['clearAnimationFrame'] = extraData['clearAnimationFrame']; | ||
} | ||
exports.setExtraFunction = setExtraFunction; | ||
function requestAnimationFrame(fn) { | ||
if (cache['requestAnimationFrame']) { | ||
return cache['requestAnimationFrame']; | ||
} | ||
var method = typeof window === 'object' && window.requestAnimationFrame | ||
@@ -14,2 +24,5 @@ ? window.requestAnimationFrame | ||
function clearAnimationFrame(handler) { | ||
if (cache['clearAnimationFrame']) { | ||
return cache['clearAnimationFrame']; | ||
} | ||
var method = typeof window === 'object' && window.cancelAnimationFrame ? window.cancelAnimationFrame : clearTimeout; | ||
@@ -16,0 +29,0 @@ return method(handler); |
@@ -28,4 +28,5 @@ export declare function getPixelRatio(): number; | ||
export declare function isSamePoint(point1: any, point2: any): boolean; | ||
export { isNil, isString, isFunction, isArray, each, toRadian, mod, isNumberEqual, requestAnimationFrame, clearAnimationFrame, } from '@antv/util'; | ||
export { isNil, isString, isFunction, isArray, each, toRadian, mod, isNumberEqual } from '@antv/util'; | ||
export { requestAnimationFrame, clearAnimationFrame } from './time'; | ||
export declare function tick(fn: FrameRequestCallback): void; | ||
export declare function isParent(container: any, shape: any): boolean; |
@@ -69,4 +69,5 @@ "use strict"; | ||
Object.defineProperty(exports, "isNumberEqual", { enumerable: true, get: function () { return util_1.isNumberEqual; } }); | ||
Object.defineProperty(exports, "requestAnimationFrame", { enumerable: true, get: function () { return util_1.requestAnimationFrame; } }); | ||
Object.defineProperty(exports, "clearAnimationFrame", { enumerable: true, get: function () { return util_1.clearAnimationFrame; } }); | ||
var time_1 = require("./time"); | ||
Object.defineProperty(exports, "requestAnimationFrame", { enumerable: true, get: function () { return time_1.requestAnimationFrame; } }); | ||
Object.defineProperty(exports, "clearAnimationFrame", { enumerable: true, get: function () { return time_1.clearAnimationFrame; } }); | ||
function tick(fn) { | ||
@@ -73,0 +74,0 @@ if (window) { |
{ | ||
"name": "@antv/g-mobile", | ||
"version": "0.0.3", | ||
"version": "0.0.5", | ||
"description": "A mobile canvas library which providing 2d", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -8,3 +8,3 @@ import { AbstractCanvas, CanvasCfg, Point } from '@antv/g-base'; | ||
import { each, getPixelRatio } from './util/util'; | ||
import { requestAnimationFrame, clearAnimationFrame } from './util/time'; | ||
import { requestAnimationFrame, clearAnimationFrame, setExtraFunction } from './util/time'; | ||
import { applyAttrsToContext, drawChildren, getMergedRegion, mergeView, checkRefresh, clearChanged } from './util/draw'; | ||
@@ -24,2 +24,3 @@ import EventController from './events'; | ||
// TODO 这里会传递过来extra,里面包含一些来自各个平台的优化函数 | ||
setExtraFunction(this.get('extra')); | ||
} else { | ||
@@ -26,0 +27,0 @@ // 小程序使用了自定义的canvas api,不兼容w3c标准 |
@@ -0,2 +1,12 @@ | ||
const cache = {}; | ||
export function setExtraFunction(extraData: any = {}) { | ||
cache['requestAnimationFrame'] = extraData['requestAnimationFrame']; | ||
cache['clearAnimationFrame'] = extraData['clearAnimationFrame']; | ||
} | ||
function requestAnimationFrame(fn: FrameRequestCallback) { | ||
if (cache['requestAnimationFrame']) { | ||
return cache['requestAnimationFrame']; | ||
} | ||
const method = | ||
@@ -12,2 +22,5 @@ typeof window === 'object' && window.requestAnimationFrame | ||
function clearAnimationFrame(handler: number) { | ||
if (cache['clearAnimationFrame']) { | ||
return cache['clearAnimationFrame']; | ||
} | ||
const method = typeof window === 'object' && window.cancelAnimationFrame ? window.cancelAnimationFrame : clearTimeout; | ||
@@ -14,0 +27,0 @@ return method(handler); |
@@ -57,15 +57,6 @@ export function getPixelRatio() { | ||
export { | ||
isNil, | ||
isString, | ||
isFunction, | ||
isArray, | ||
each, | ||
toRadian, | ||
mod, | ||
isNumberEqual, | ||
requestAnimationFrame, | ||
clearAnimationFrame, | ||
} from '@antv/util'; | ||
export { isNil, isString, isFunction, isArray, each, toRadian, mod, isNumberEqual } from '@antv/util'; | ||
export { requestAnimationFrame, clearAnimationFrame } from './time'; | ||
export function tick(fn: FrameRequestCallback) { | ||
@@ -72,0 +63,0 @@ if (window) { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1973591
13211