Removes wx API invocations for JSB projects. (#2668)

* Removes wx API invocation for JSB projects.

* sys.openURL fix for JSB.

* touches, mouse, keyboard capabilities check.
This commit is contained in:
James Chen
2018-05-11 18:00:40 +08:00
committed by pandamicro
parent f326869f47
commit cd07d03b7d
8 changed files with 72 additions and 72 deletions
-24
View File
@@ -24,30 +24,6 @@
****************************************************************************/
window.CC_JSB = true;
window.CC_WECHATGAME = true; //FIXME: remove CC_WECHATGAME
// Simulate wechat game API:
//FIXME: remove wx
window.wx = {
getSystemInfoSync() {
return {
platform: 'mac',
language: 'CN',
system: 1.0,
windowWidth: window.innerWidth,
windowHeight: window.innerHeight,
};
},
onShow() {
},
onHide() {
}
}
window.CanvasRenderingContext2D = cc.CanvasRenderingContext2D;
delete cc.CanvasRenderingContext2D;
+1 -1
View File
@@ -45,7 +45,7 @@ class Audio extends HTMLAudioElement {
//
// _src.set(this, '')
//
// const innerAudioContext = {};//cjh wx.createInnerAudioContext()
// const innerAudioContext = {};
//
// _innerAudioContext.set(this, innerAudioContext)
//
@@ -29,6 +29,12 @@ class HTMLVideoElement extends HTMLMediaElement {
constructor() {
super('video')
}
canPlayType(type) {
if (type === 'video/mp4')
return true;
return false;
}
}
module.exports = HTMLVideoElement;
+1
View File
@@ -29,6 +29,7 @@ class Node extends EventTarget {
constructor() {
super()
this.childNodes = []
this.parentNode = window.__cccanvas;
}
appendChild(node) {
+3 -6
View File
@@ -25,16 +25,13 @@
let { noop } = require('./util');
// TODO 需要 wx.getSystemInfo 获取更详细信息
// cjh const { platform } = wx.getSystemInfoSync()
const navigator = {
platform: 'wx', //cjh added wx
language: 'zh-cn',
platform: __getOS(),
language: __getCurrentLanguage(),
appVersion: '5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1',
userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Mobile/14E8301 NetType/WIFI Language/zh_CN',
onLine: true, // TODO 用 wx.getNetworkStateChange 和 wx.onNetworkStateChange 来返回真实的状态
onLine: true, //FIXME:
// TODO 用 wx.getLocation 来封装 geolocation
geolocation: {
getCurrentPosition: noop,
watchPosition: noop,
+2
View File
@@ -45,6 +45,8 @@ function inject () {
window.HTMLAudioElement = require('./HTMLAudioElement');
window.HTMLVideoElement = require('./HTMLVideoElement');
window.__cccanvas = new HTMLCanvasElement();
window.__cccanvas._width = window.innerWidth;
window.__cccanvas._height = window.innerHeight;
window.__ccgl.canvas = window.__cccanvas;
window.navigator = require('./navigator');
window.Image = require('./Image');