@qiniu/miku-mp
Advanced tools
Comparing version 0.0.1-beta.1 to 0.0.1
@@ -68,9 +68,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
}, | ||
onError(event) { | ||
this.data.errorHandler(event); | ||
this.triggerEvent('error', event.detail); | ||
}, | ||
onLoad(event) { | ||
this.data.loadHandler(event); | ||
this.triggerEvent('load', event.detail); | ||
proxyEvent(event) { | ||
if (event.type === 'error') { | ||
this.data.errorHandler(event); | ||
} | ||
else if (event.type === 'load') { | ||
this.data.loadHandler(event); | ||
} | ||
this.triggerEvent(event.type, event.detail); | ||
} | ||
@@ -80,4 +81,3 @@ }, | ||
attached() { | ||
debug('attached'); | ||
debug('properties:', this.properties); | ||
debug('attached with properties:', this.properties); | ||
this.resolveSrc(); | ||
@@ -88,3 +88,2 @@ } | ||
src() { | ||
debug('src changed'); | ||
this.resolveSrc(); | ||
@@ -91,0 +90,0 @@ } |
@@ -19,5 +19,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
return { | ||
// 支持外部操作 videoContext: | ||
// 通过 `const mikuVideo = this.selectComponent('#xxx')` 拿到 miku-video 在这里 export 的对象, | ||
// 再通过 `mikuVideo.videoContext` 操作 videoContext | ||
// 支持外部操作 videoContext:通过 | ||
// ``` | ||
// <miku-video id="xxx"> | ||
// const mikuVideo = this.selectComponent('#xxx') | ||
// ``` | ||
// 拿到我们在这里 export 的对象,再通过 `mikuVideo.videoContext` 即可操作 videoContext | ||
videoContext: wx.createVideoContext('video', this) | ||
@@ -136,4 +139,4 @@ }; | ||
try { | ||
yield resolver.do(new Context(), this.data.src, 2, (resolved) => __awaiter(this, void 0, void 0, function* () { | ||
const finalSrc = withResolved(this.data.src, resolved); | ||
yield resolver.do(new Context(), src, 2, (resolved) => __awaiter(this, void 0, void 0, function* () { | ||
const finalSrc = withResolved(src, resolved); | ||
return new Promise((resolve, reject) => { | ||
@@ -154,3 +157,3 @@ this.setData({ | ||
console.warn('video fallback for:', e); | ||
this.setData({ finalSrc: this.data.src }); | ||
this.setData({ finalSrc: src }); | ||
} | ||
@@ -172,4 +175,3 @@ }); | ||
attached() { | ||
debug('attached'); | ||
debug('properties:', this.properties); | ||
debug('attached with properties:', this.properties); | ||
this.resolveSrc(); | ||
@@ -180,3 +182,2 @@ }, | ||
src() { | ||
debug('src changed'); | ||
this.resolveSrc(); | ||
@@ -183,0 +184,0 @@ } |
@@ -36,4 +36,3 @@ /** | ||
headers: new Headers({ | ||
'Authorization': accessToken, | ||
'Content-Type': 'none' // 覆盖 wx.request 默认带的 application/json,后者会导致接口 400 | ||
'Authorization': accessToken | ||
}) | ||
@@ -40,0 +39,0 @@ }); |
@@ -24,2 +24,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
deferedShared.resolve({ resolver, domains }); | ||
// 对传入的域名进行预解析,而不是等到页面上具体的 image / video 渲染时才去解析 | ||
yield Promise.all(domains.map(domain => (resolver.resolveDomain(new Context(), domain)))); | ||
@@ -26,0 +27,0 @@ }); |
@@ -14,5 +14,5 @@ /** | ||
dev_model: systemInfo.model, | ||
dev_id: '' // TODO: 似乎也没有对应接口? | ||
dev_id: '' | ||
}; | ||
} | ||
//# sourceMappingURL=env.js.map |
@@ -8,3 +8,6 @@ /** | ||
export function fetch({ url, method, headers, body }) { | ||
const header = {}; | ||
const header = { | ||
// 避免 `wx.request` 默认发 `content-type: application/json` 的行为,后者可能会导致问题(如 httpdns 接口会 400) | ||
'content-type': 'none' | ||
}; | ||
if (headers != null) { | ||
@@ -11,0 +14,0 @@ headers.forEach((value, key) => { |
@@ -21,4 +21,4 @@ import { Polyfilled_URL } from './url'; | ||
u.hash = ''; | ||
expect(u.href).toBe('https://u:p@q.com:8080/foo/bar'); // not correct here | ||
expect(u.href).toBe('https://u:p@q.com:8080/foo/bar'); | ||
}); | ||
//# sourceMappingURL=url.spec.js.map |
{ | ||
"name": "@qiniu/miku-mp", | ||
"version": "0.0.1-beta.1", | ||
"version": "0.0.1", | ||
"description": "Miku SDK for Mini Programs", | ||
@@ -5,0 +5,0 @@ "miniprogram": "dist", |
@@ -13,3 +13,3 @@ # Miku SDK for Mini Programs | ||
# 去小程序目录下,链接 miku-mp 包 | ||
npm link miku-mp | ||
npm link @qiniu/miku-mp | ||
# 接着通过小程序开发工具: Tools / Build npm 即可 | ||
@@ -20,1 +20,7 @@ # 注意有时执行完 Build npm 后,console 会报错 | ||
``` | ||
### 发布 | ||
```sh | ||
npm publish --access public | ||
``` |
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
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
5957
25
1080139