How to use westfield-runtime-common - 6 common examples

To help you get started, we’ve selected a few westfield-runtime-common examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github udevbe / westfield / client / runtime / src / index.js View on Github external
import GrWebShmProxy from './protocol/GrWebShmProxy'
import GrWebShmBufferEvents from './protocol/GrWebShmBufferEvents'

// web gl
import GrWebGlBufferProxy from './protocol/GrWebGlBufferProxy'
import GrWebGlProxy from './protocol/GrWebGlProxy'
import GrWebGlBufferEvents from './protocol/GrWebGlBufferEvents'

/**
 * @type {WebFS}
 */
const webFS = WebFS.create(_uuidv4())
/**
 * @type {Connection}
 */
const connection = new Connection()
/**
 * @type {Display}
 */
const display = new Display(connection)

/**
 * @returns {string}
 * @private
 */
function _uuidv4 () {
  return ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, c =>
    (c ^ self.crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16)
  )
}

/**
github udevbe / westfield / server / web / runtime / src / Client.js View on Github external
constructor (display, id) {
    super()
    /**
     * @type {string}
     */
    this.id = id
    /**
     * @type {Connection}
     */
    this.connection = new Connection()
    /**
     * @type {Display}
     * @private
     */
    this._display = display
    /**
     * @type {number}
     * @private
     */
    this._syncEventSerial = 0
    /**
     * @type {function():void}
     * @private
     */
    this._destroyedResolver = null
    /**
github udevbe / westfield / client / runtime / src / Display.js View on Github external
constructor () {
    super()
    /**
     * @type {number}
     */
    this.nextId = 1
    /**
     * @type {Connection}
     */
    this.connection = new Connection()
    /**
     * @type {WlDisplayProxy}
     */
    this.displayProxy = new WlDisplayProxy(this, this.nextId++)
    /**
     * @type {Display}
     */
    this.displayProxy.listener = this
  }
github udevbe / westfield / client / runtime / src / WebFS.js View on Github external
fromArrayBuffer (arrayBuffer) {
    const fd = this._nextFD++
    const type = 'ArrayBuffer'

    const webFdURL = new URL(`client://`)
    webFdURL.searchParams.append('fd', `${fd}`)
    webFdURL.searchParams.append('type', type)
    webFdURL.searchParams.append('clientId', this._fdDomainUUID)

    const webFD = new WebFD(fd, type, webFdURL, () => Promise.resolve(arrayBuffer), () => { delete this._webFDs[fd] })
    this._webFDs[fd] = webFD
    return webFD
  }
github udevbe / westfield / client / runtime / src / WebFS.js View on Github external
fromOffscreenCanvas (offscreenCanvas) {
    const fd = this._nextFD++
    const type = 'OffscreenCanvas'

    const webFdURL = new URL(`client://`)
    webFdURL.searchParams.append('fd', `${fd}`)
    webFdURL.searchParams.append('type', type)
    webFdURL.searchParams.append('clientId', this._fdDomainUUID)

    const webFD = new WebFD(fd, type, webFdURL, () => Promise.resolve(offscreenCanvas), () => { delete this._webFDs[fd] })
    this._webFDs[fd] = webFD
    return webFD
  }
github udevbe / westfield / client / runtime / src / WebFS.js View on Github external
fromImageBitmap (imageBitmap) {
    const fd = this._nextFD++
    const type = 'ImageBitmap'

    const webFdURL = new URL(`client://`)
    webFdURL.searchParams.append('fd', `${fd}`)
    webFdURL.searchParams.append('type', type)
    webFdURL.searchParams.append('clientId', this._fdDomainUUID)

    const webFD = new WebFD(fd, type, webFdURL, () => Promise.resolve(imageBitmap), () => { delete this._webFDs[fd] })
    this._webFDs[fd] = webFD
    return webFD
  }

westfield-runtime-common

Wayland HTML5 common client-server runtime

MIT
Latest version published 1 year ago

Package Health Score

45 / 100
Full package analysis