mp_hextech_v1/app.js
2024-08-02 16:55:52 +08:00

33 lines
808 B
JavaScript

import updateManager from './common/updateManager';
var fetchWechat = require('fetch-wechat');
var tf = require('@tensorflow/tfjs-core');
var webgl = require('@tensorflow/tfjs-backend-webgl');
var plugin = requirePlugin('tfjsPlugin');
App({
globalData: {
localStorageIO: plugin.localStorageIO,
systemInfo: {}
},
onLaunch: function () {
plugin.configPlugin({
// polyfill fetch function
fetchFunc: fetchWechat.fetchFunc(),
// inject tfjs runtime
tf,
// inject webgl backend
webgl,
// provide webgl canvas
canvas: wx.createOffscreenCanvas()
},
true);
const systemInfo = wx.getSystemInfoSync();
this.globalData.systemInfo = wx.getSystemInfoSync();
},
onShow: function () {
updateManager();
},
});