33 lines
808 B
JavaScript
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();
|
|
},
|
|
}); |