How to use the yox.prototype function in yox

To help you get started, we’ve selected a few yox 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 divawth / bell-ui / src / component / loading-bar / index.ts View on Github external
LoadingBar
    )
  )

  return instance

}

function remove() {
  if (instance) {
    instance.destroy()
    instance = UNDEFINED
  }
}

(Yox.prototype as any).$loadingBar = {
  // 开始从 0 显示进度条,并自动加载进度
  start(options?: Config) {
    if (instance) {
      remove()
    }
    return add(options)
  },
  // 结束进度条,自动补全剩余进度
  finish() {
    if (instance) {
      instance.set('percent', 100)
      setTimeout(remove, 300)
    }
  },
  // 精确加载到指定的进度
  update(data: Config) {
github divawth / bell-ui / src / component / modal / index.ts View on Github external
import Yox, { Data } from 'yox'

import { BODY } from '../constant'

import Alert from './Alert'
import Confirm from './Confirm'

type Arg = string | Data

const prototype = Yox.prototype as any

prototype.$alert = function (data: Arg) {

  const props: Data = {}

  if (Yox.is.object(data)) {
    const obj = data as Data
    props.closable = obj.closable
    props.title = obj.title
    props.content = obj.content
    props.width = obj.width
    props.okText = obj.okText
    props.okType = obj.okType
    props.onOk = obj.onOk
  }
  else {
github divawth / bell-ui / src / component / message / index.ts View on Github external
}
    instance.destroy()
  })

  setTimeout(
    function () {
      if (instance.$el) {
        instance.show(props.top || 15, props.duration || 2000)
      }
    },
    300
  )

}

(Yox.prototype as any).$message = {
  success(arg: Arg, onClose?: Function) {
    addMessage('success', arg, onClose)
  },
  info(arg: Arg, onClose?: Function) {
    addMessage('info', arg, onClose)
  },
  warning(arg: Arg, onClose?: Function) {
    addMessage('warning', arg, onClose)
  },
  error(arg: Arg, onClose?: Function) {
    addMessage('error', arg, onClose)
  },
  config(arg: Data) {
    Yox.object.extend(config, arg)
  }
}
github divawth / bell-ui / src / component / notification / index.ts View on Github external
}
    instance.destroy()
  })

  setTimeout(
    function () {
      if (instance.$el) {
        instance.show()
      }
    },
    300
  )

}

(Yox.prototype as any).$notification = {
  success(props: Data, onClose?: Function) {
    addNotification('success', props, onClose)
  },
  info(props: Data, onClose?: Function) {
    addNotification('info', props, onClose)
  },
  warning(props: Data, onClose?: Function) {
    addNotification('warning', props, onClose)
  },
  error(props: Data, onClose?: Function) {
    addNotification('error', props, onClose)
  },
  config(options: Data) {
    Yox.object.extend(config, options)
  }
}

yox

A lightweight mvvm framework

MIT
Latest version published 2 years ago

Package Health Score

45 / 100
Full package analysis