Skip to content

Commit 56d2ce6

Browse files
committed
fix: work within Weapp again
retire the obsoleted subprotocol paramlization
1 parent cd4775e commit 56d2ce6

File tree

4 files changed

+19
-28
lines changed

4 files changed

+19
-28
lines changed

package-lock.json

Lines changed: 15 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
"@babel/runtime": "^7.7.4",
8787
"@leancloud/runtime-adapters-browser": "^1.0.0",
8888
"@leancloud/runtime-adapters-node": "^1.0.0",
89-
"@leancloud/runtime-adapters-weapp": "^1.0.0",
89+
"@leancloud/runtime-adapters-weapp": "^1.0.1",
9090
"base64-arraybuffer": "^0.1.5",
9191
"debug": "^3.1.0",
9292
"eventemitter3": "^3.0.0",

rollup/shared-configs.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ export const browser = {
108108

109109
const weappRuntimeReset = () => ({
110110
intro() {
111-
return 'var XMLHttpRequest;function Function(){return function(){}};';
111+
return 'global.Object=Object;function Function(){return function(){}};';
112112
},
113113
});
114114

src/connection.js

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import WebSocketPlus, {
1212
} from './websocket-plus';
1313
import { createError } from './error';
1414
import { GenericCommand, CommandType } from '../proto/message';
15-
import { trim, isWeapp } from './utils';
15+
import { trim } from './utils';
1616

1717
const debug = d('LC:Connection');
1818

@@ -37,20 +37,7 @@ export default class Connection extends WebSocketPlus {
3737
constructor(getUrl, { format, version }) {
3838
debug('initializing Connection');
3939
const protocolString = `lc.${format}.${version}`;
40-
if (!isWeapp) {
41-
super(getUrl, protocolString);
42-
} else {
43-
super(
44-
getUrl().then(urls =>
45-
urls.map(
46-
url =>
47-
`${url}${
48-
url.indexOf('?') === -1 ? '?' : '&'
49-
}subprotocol=${encodeURIComponent(protocolString)}`
50-
)
51-
)
52-
);
53-
}
40+
super(getUrl, protocolString);
5441
this._protocolFormat = format;
5542
this._commands = {};
5643
this._serialId = 0;

0 commit comments

Comments
 (0)