How to use the @tarojs/utils.SimpleMap function in @tarojs/utils

To help you get started, we’ve selected a few @tarojs/utils 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 NervJS / taro / packages / taro-quickapp / src / util.js View on Github external
const key = keys[i]
    if (i === len - 1) return obj[key]
    obj = obj[key]
  }
}

let id = 0
function genId () {
  return String(id++)
}

let compIdsMapper
try {
  compIdsMapper = new Map()
} catch (error) {
  compIdsMapper = new SimpleMap()
}
export function genCompid (key, isNeedCreate) {
  if (!Current || !Current.current || !Current.current.$scope) return []

  const prevId = compIdsMapper.get(key)
  if (isNeedCreate) {
    const id = genId()
    compIdsMapper.set(key, id)
    return [prevId, id]
  } else {
    const id = prevId || genId()
    !prevId && compIdsMapper.set(key, id)
    return [null, id]
  }
}
github NervJS / taro / packages / taro-alipay / src / util.js View on Github external
if (res) return res

  return null
}

let id = 0
function genId () {
  return String(id++)
}

let compIdsMapper
try {
  compIdsMapper = new Map()
} catch (error) {
  compIdsMapper = new SimpleMap()
}
export function genCompid (key, isNeedCreate) {
  if (!Current || !Current.current || !Current.current.$scope) return []

  const prevId = compIdsMapper.get(key)
  if (isNeedCreate) {
    const id = genId()
    compIdsMapper.set(key, id)
    return [prevId, id]
  } else {
    const id = prevId || genId()
    !prevId && compIdsMapper.set(key, id)
    return [null, id]
  }
}
github NervJS / taro / packages / taro-jd / src / util.js View on Github external
if (res) return res

  return null
}

let id = 0
function genId () {
  return String(id++)
}

let compIdsMapper
try {
  compIdsMapper = new Map()
} catch (error) {
  compIdsMapper = new SimpleMap()
}
export function genCompid (key, isNeedCreate) {
  if (!Current || !Current.current || !Current.current.$scope) return []

  const prevId = compIdsMapper.get(key)
  if (isNeedCreate) {
    const id = genId()
    compIdsMapper.set(key, id)
    return [prevId, id]
  } else {
    const id = prevId || genId()
    !prevId && compIdsMapper.set(key, id)
    return [null, id]
  }
}
github NervJS / taro / packages / taro-qq / src / util.js View on Github external
if (res) return res

  return null
}

let id = 0
function genId () {
  return String(id++)
}

let compIdsMapper
try {
  compIdsMapper = new Map()
} catch (error) {
  compIdsMapper = new SimpleMap()
}
export function genCompid (key, isNeedCreate) {
  if (!Current || !Current.current || !Current.current.$scope) return []

  const prevId = compIdsMapper.get(key)
  if (isNeedCreate) {
    const id = genId()
    compIdsMapper.set(key, id)
    return [prevId, id]
  } else {
    const id = prevId || genId()
    !prevId && compIdsMapper.set(key, id)
    return [null, id]
  }
}
github NervJS / taro / packages / taro-tt / src / util.js View on Github external
res && triggerLoopRef(component.$component, res, handler)
  }

  return null
}

let id = 0
function genId () {
  return String(id++)
}

let compIdsMapper
try {
  compIdsMapper = new Map()
} catch (error) {
  compIdsMapper = new SimpleMap()
}
export function genCompid (key, isNeedCreate) {
  if (!Current || !Current.current || !Current.current.$scope) return []

  const prevId = compIdsMapper.get(key)
  if (isNeedCreate) {
    const id = genId()
    compIdsMapper.set(key, id)
    return [prevId, id]
  } else {
    const id = prevId || genId()
    !prevId && compIdsMapper.set(key, id)
    return [null, id]
  }
}
github NervJS / taro / packages / taro-weapp / src / util.js View on Github external
if (res) return res

  return null
}

let id = 0
function genId () {
  return String(id++)
}

let compIdsMapper
try {
  compIdsMapper = new Map()
} catch (error) {
  compIdsMapper = new SimpleMap()
}
export function genCompid (key, isNeedCreate) {
  if (!Current || !Current.current || !Current.current.$scope) return []

  const prevId = compIdsMapper.get(key)
  if (isNeedCreate) {
    const id = genId()
    compIdsMapper.set(key, id)
    return [prevId, id]
  } else {
    const id = prevId || genId()
    !prevId && compIdsMapper.set(key, id)
    return [null, id]
  }
}
github NervJS / taro / packages / taro-swan / src / util.js View on Github external
if (res) return res

  return null
}

let id = 0
function genId () {
  return String(id++)
}

let compIdsMapper
try {
  compIdsMapper = new Map()
} catch (error) {
  compIdsMapper = new SimpleMap()
}
export function genCompid (key, isNeedCreate) {
  if (!Current || !Current.current || !Current.current.$scope) return []

  const prevId = compIdsMapper.get(key)
  if (isNeedCreate) {
    const id = genId()
    compIdsMapper.set(key, id)
    return [prevId, id]
  } else {
    const id = prevId || genId()
    !prevId && compIdsMapper.set(key, id)
    return [null, id]
  }
}

@tarojs/utils

Utils for Taro

MIT
Latest version published 4 years ago

Package Health Score

70 / 100
Full package analysis