Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Object.seal will throw an error in IE11 #75

Open
Alex-Sokolov opened this issue Nov 8, 2018 · 7 comments
Open

Object.seal will throw an error in IE11 #75

Alex-Sokolov opened this issue Nov 8, 2018 · 7 comments

Comments

@Alex-Sokolov
Copy link

Now in build (https://raw.githubusercontent.com/nathantsoi/vue-native-websocket/master/dist/build.js) there is Object.seal(this.$options.sockets) using

IE11 doesn't know what it is & will throw error. I think need to include polyfill for Object.seal or mention about it in readme

@Alex-Sokolov Alex-Sokolov changed the title IE11 compatibility Object.seal will throw an error in IE11 Nov 8, 2018
@larsmars
Copy link

I have the same:
Please make a work around for IE11

[Vue warn]: Error in created hook: "TypeError: Object.seal: argument is not an Object"

"vue": "^2.5.17",
"vue-native-websocket": "^2.0.9",
"@vue/cli-plugin-babel": "^3.0.1",
"@vue/cli-plugin-eslint": "^3.0.1",
"@vue/cli-plugin-unit-jest": "^3.0.1",
"@vue/cli-service": "^3.0.1",

@Jabbar2010
Copy link

放弃这个插件吧,ie11g等不支持Proxy的逻辑作者没有实现好,无法使用

@larsmars
Copy link

This is not a solution and this bug should not be marked as "fixed" this is a work around/hack
to make the application not crash into a ditch if using IE11:

Only mount the plugin if modern browser

In your main.js file:

import VueNativeSock from 'vue-native-websocket'

if (!(window.ActiveXObject) && 'ActiveXObject' in window) {
  store.dispatch('app/setModernBrowser', false)
} else {
  Vue.use(VueNativeSock, wsUrl(), {
    store: store,
    connectManually: true,
    format: 'json'
  })
  store.dispatch('app/setModernBrowser', true)
}

@PrinceMagbanua
Copy link

@larsmars this guy made it work without using Proxy object. Tested it and it works properly.
https://www.npmjs.com/package/vue-native-websocket-es5

@larsmars
Copy link

@larsmars this guy made it work without using Proxy object. Tested it and it works properly.
https://www.npmjs.com/package/vue-native-websocket-es5

What did he do? That package ref. to this repo.
Will it work properly on IE11?

@paulinekorkina
Copy link

paulinekorkina commented Oct 25, 2019

I've fixed the same error with @babel/polyfill

@Perlover
Copy link

Now in build (https://raw.githubusercontent.com/nathantsoi/vue-native-websocket/master/dist/build.js) there is Object.seal(this.$options.sockets) using

IE11 doesn't know what it is & will throw error. I think need to include polyfill for Object.seal or mention about it in readme

I think it's because the this.$options.sockets is not the object (i think it's undefined) and IE11 follows to ES5 code:

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/seal#Non-object_coercion

Perlover added a commit to Perlover/vue-native-websocket that referenced this issue Nov 13, 2020
Hi,

I see strange option `sockets` parameter which can be undefined if user didn't define it in `Vue` options. If I understand as right it may be bug.

It can be related with this opened issue: nathantsoi#75

And the [Object.seal should get the object type](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/seal#Non-object_coercion). If it will be not object ES5 code will throw error. I didn't test it but i saw code and think that's should be patched.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants