Commit 65a01dd3 authored by wildfirecode13's avatar wildfirecode13

1

parent 26d3d237
/**
* 获取星速台token
*/
export declare const getPxToken: () => Promise<unknown>;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getPxToken = void 0;
/**
* 获取星速台token
*/
exports.getPxToken = function () {
return new Promise(function (resolve, reject) {
if (location.href.indexOf('localhost') > -1) {
resolve('local-token');
}
else {
window.getPxToken(function (e, token) {
if (!e) {
resolve(token);
}
else {
reject(e);
}
});
}
});
};
import SVGA = require("svgaplayerweb"); import SVGA = require("svgaplayerweb");
export declare const loadSVGA: (url: string) => Promise<unknown>; /**
* 快速加载svga资源,但不装载
* @param url 资源URL
*/
export declare const loadSVGA: (url: string) => Promise<SVGA.VideoEntity>;
/**
* 快速装载一个svga动画
* @param url 资源URL
* @param className 挂载元素的class name
* @param loops 播放次数。默认为空,循环播放。
* @param clearsAfterStop
*/
export declare const getSVGA: (url: string, className: string, loops: number, clearsAfterStop: boolean) => Promise<SVGA.Player>; export declare const getSVGA: (url: string, className: string, loops: number, clearsAfterStop: boolean) => Promise<SVGA.Player>;
...@@ -39,6 +39,10 @@ Object.defineProperty(exports, "__esModule", { value: true }); ...@@ -39,6 +39,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
exports.getSVGA = exports.loadSVGA = void 0; exports.getSVGA = exports.loadSVGA = void 0;
var SVGA = require("svgaplayerweb"); var SVGA = require("svgaplayerweb");
var svgaParser = new SVGA.Parser(); var svgaParser = new SVGA.Parser();
/**
* 快速加载svga资源,但不装载
* @param url 资源URL
*/
exports.loadSVGA = function (url) { exports.loadSVGA = function (url) {
return new Promise(function (resolve, reject) { return new Promise(function (resolve, reject) {
svgaParser.load(url, function (videoItem) { svgaParser.load(url, function (videoItem) {
...@@ -48,6 +52,13 @@ exports.loadSVGA = function (url) { ...@@ -48,6 +52,13 @@ exports.loadSVGA = function (url) {
}); });
}); });
}; };
/**
* 快速装载一个svga动画
* @param url 资源URL
* @param className 挂载元素的class name
* @param loops 播放次数。默认为空,循环播放。
* @param clearsAfterStop
*/
exports.getSVGA = function (url, className, loops, clearsAfterStop) { return __awaiter(void 0, void 0, void 0, function () { exports.getSVGA = function (url, className, loops, clearsAfterStop) { return __awaiter(void 0, void 0, void 0, function () {
var videoItem, svga; var videoItem, svga;
return __generator(this, function (_a) { return __generator(this, function (_a) {
......
...@@ -91,3 +91,9 @@ const videoItem = await loadSVGA(url); ...@@ -91,3 +91,9 @@ const videoItem = await loadSVGA(url);
<script src="getTokenKey"></script> <script src="getTokenKey"></script>
<script src="//yun.duiba.com.cn/js-libs/px-token/0.0.4/px-token.min.js"></script> <script src="//yun.duiba.com.cn/js-libs/px-token/0.0.4/px-token.min.js"></script>
``` ```
用法
```js
import {getPxToken } from "teddi";
const token = await getPxToken();
const result = await API.doSign({token});
```
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment