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

fix SSR #11

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dist/bundle.es.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/bundle.umd.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@kinescope/vue-kinescope-player",
"version": "1.0.5",
"version": "1.0.6",
"description": "Vue.js wrapper for Kinescope player",
"scripts": {
"build": "rollup -c",
Expand Down Expand Up @@ -57,7 +57,7 @@
"standard-version": "^4.2.0"
},
"peerDependencies": {
"vue": "^2.5.17"
"vue": "^2.7.16 || ^3.4.38"
},
"standard-version": {
"scripts": {
Expand Down
1 change: 1 addition & 0 deletions src/constants.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export const IS_BROWSER = typeof window !== 'undefined' && window.document
export const VIDEO_HOST = 'https://kinescope.io/embed/'
export const PLAYER_LATEST = 'https://player.kinescope.io/latest/iframe.player.js'
export const NODE_JS_ID = '__kinescope_player_vue_js'
Expand Down
6 changes: 4 additions & 2 deletions src/loader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@
</template>

<script>
import {PLAYER_LATEST, NODE_JS_ID} from './constants'
import {PLAYER_LATEST, NODE_JS_ID, IS_BROWSER} from './constants'

export default {
name: 'Loader',
created () {
this.jsLoading()
if (IS_BROWSER) {
this.jsLoading()
}
},
methods: {
loadJsNotLoad () {
Expand Down
4 changes: 3 additions & 1 deletion src/polyfills.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// polyfill for replaceChildren
import { IS_BROWSER } from './constants'

(function () {
if (Node && Node.prototype.replaceChildren === undefined) {
if (IS_BROWSER && Node.prototype.replaceChildren === undefined) {
Node.prototype.replaceChildren = function (addNodes) {
while (this.lastChild) {
this.removeChild(this.lastChild)
Expand Down