EroticDungeonGame/node_modules/universalify
3944Realms 8c4ce2709c fix(兼容emotescraft和rideeverything): 修改骑乘逻辑和tick取消EmtoesCraft表情
使用Mixin中检测绕过骑乘取消和开始骑乘逻辑,避免原版的unRide方法导致非预期的退出设备;在每tick检测,如果在设备上则停止表情动画
2026-02-20 14:45:57 +08:00
..
index.js fix(兼容emotescraft和rideeverything): 修改骑乘逻辑和tick取消EmtoesCraft表情 2026-02-20 14:45:57 +08:00
LICENSE fix(兼容emotescraft和rideeverything): 修改骑乘逻辑和tick取消EmtoesCraft表情 2026-02-20 14:45:57 +08:00
package.json fix(兼容emotescraft和rideeverything): 修改骑乘逻辑和tick取消EmtoesCraft表情 2026-02-20 14:45:57 +08:00
README.md fix(兼容emotescraft和rideeverything): 修改骑乘逻辑和tick取消EmtoesCraft表情 2026-02-20 14:45:57 +08:00

universalify

GitHub Workflow Status (branch) Coveralls github branch npm npm

Make a callback- or promise-based function support both promises and callbacks.

Uses the native promise implementation.

Installation

npm install universalify

API

universalify.fromCallback(fn)

Takes a callback-based function to universalify, and returns the universalified function.

Function must take a callback as the last parameter that will be called with the signature (error, result). universalify does not support calling the callback with three or more arguments, and does not ensure that the callback is only called once.

function callbackFn (n, cb) {
  setTimeout(() => cb(null, n), 15)
}

const fn = universalify.fromCallback(callbackFn)

// Works with Promises:
fn('Hello World!')
.then(result => console.log(result)) // -> Hello World!
.catch(error => console.error(error))

// Works with Callbacks:
fn('Hi!', (error, result) => {
  if (error) return console.error(error)
  console.log(result)
  // -> Hi!
})

universalify.fromPromise(fn)

Takes a promise-based function to universalify, and returns the universalified function.

Function must return a valid JS promise. universalify does not ensure that a valid promise is returned.

function promiseFn (n) {
  return new Promise(resolve => {
    setTimeout(() => resolve(n), 15)
  })
}

const fn = universalify.fromPromise(promiseFn)

// Works with Promises:
fn('Hello World!')
.then(result => console.log(result)) // -> Hello World!
.catch(error => console.error(error))

// Works with Callbacks:
fn('Hi!', (error, result) => {
  if (error) return console.error(error)
  console.log(result)
  // -> Hi!
})

License

MIT