-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
37 lines (35 loc) · 923 Bytes
/
app.js
File metadata and controls
37 lines (35 loc) · 923 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
const fetchWechat = require('fetch-wechat');
const tf = require('@tensorflow/tfjs-core');
const webgl = require('@tensorflow/tfjs-backend-webgl');
const plugin = requirePlugin('tfjsPlugin');
const ENABLE_DEBUG = true;
// app.js
App({
async onLaunch() {
// 展示本地存储能力
const logs = wx.getStorageSync('logs') || []
logs.unshift(Date.now())
wx.setStorageSync('logs', logs)
// 登录
wx.login({
success: res => {
// 发送 res.code 到后台换取 openId, sessionKey, unionId
}
})
plugin.configPlugin(
{
fetchFunc: fetchWechat.fetchFunc(),
tf,
webgl,
canvas: wx.createOffscreenCanvas()
},
ENABLE_DEBUG);
const info = wx.getSystemInfoSync();
console.log(info.platform);
},
globalData: {
userInfo: null,
fileStorageIO: plugin.fileStorageIO,
localStorageIO: plugin.localStorageIO
}
})