How to use the lie.resolve function in lie

To help you get started, we’ve selected a few lie 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 nolanlawson / promise-worker / test / worker-error-async.js View on Github external
register(function () {
  return Promise.resolve().then(function () {
    throw new Error('oh noes')
  })
})
github nolanlawson / promise-worker / test / worker-pong-promise.js View on Github external
register(function () {
  return Promise.resolve('pong')
})
github uxcore / uxcore-table / tests / tree.spec.jsx View on Github external
function loadTreeDataWithAsync() {
  return Promise.resolve(addedContent);
}
github minznerjosh / vast-player / test / spec / java_script_vpaid.player.ut.js View on Github external
beforeEach(function(done) {
                                    spyOn(player, 'resizeAd').and.returnValue(LiePromise.resolve(player));

                                    container.style.width = '1024px';
                                    container.style.height = '768px';

                                    process.nextTick(done);
                                });
github enketo / enketo-core / src / js / Form-model.js View on Github external
this.model.$.trigger( 'dataupdate', updated );
            //add type="file" attribute for file references
            if ( xmlDataType === 'binary' ) {
                if ( newVal.length > 0 ) {
                    $target.attr( 'type', 'file' );
                } else {
                    $target.removeAttr( 'type' );
                }
            }

            return success;
        }
        if ( $target.length > 1 ) {
            console.error( 'nodeset.setVal expected nodeset with one node, but received multiple' );
            return Promise.resolve( null );
        }
        if ( $target.length === 0 ) {
            console.log( 'Data node: ' + this.selector + ' with null-based index: ' + this.index + ' not found. Ignored.' );
            return Promise.resolve( null );
        }
        //always validate if the new value is not empty, even if value didn't change (see validateAll() function)
        //return (newVal.length > 0 && validateAll) ? this.validate(expr, xmlDataType) : true;
        return Promise.resolve( null );
    };
github minznerjosh / vast-player / lib / players / HTMLVideo.js View on Github external
HTMLVideo.prototype.pauseAd = method(function pauseAd() {
    var self = this;
    var video = this.video;

    if (this.video.paused) {
        return LiePromise.resolve(this);
    }

    return new LiePromise(function callPause(resolve) {
        once(video, HTML_MEDIA_EVENTS.PAUSE, function onpause() {
            resolve(self);
            self.emit(VPAID_EVENTS.AdPaused);
        });

        return video.pause();
    });
}, true);
github nolanlawson / promise-worker / bin / build-worker-bundles.js View on Github external
'use strict'

var Promise = require('lie')
var denodeify = require('denodeify')
var rimraf = denodeify(require('rimraf'))
var mkdirp = denodeify(require('mkdirp'))
var glob = require('glob-promise')
var streamToPromise = require('stream-to-promise')
var browserify = require('browserify')
var fs = require('fs')
var writeFile = denodeify(fs.writeFile)
var path = require('path')

Promise.resolve().then(function () {
  return rimraf('test/bundle')
}).then(function () {
  return mkdirp('test/bundle')
}).then(function () {
  return glob('test/worker*js')
}).then(function (files) {
  return Promise.all(files.map(function (file) {
    var b = browserify(file, { debug: true })
    if (process.env.COVERAGE === '1') {
      b = b.transform('istanbulify')
    }
    b = b.bundle()
    return streamToPromise(b).then(function (buff) {
      var outputFile = 'bundle-' + path.basename(file)
      return writeFile(outputFile, buff, 'utf-8')
    })
github hoodiehq / hoodie-store-client / lib / validate.js View on Github external
function validate (state, doc) {
  if (state.validate === undefined) {
    return Promise.resolve()
  }

  return Promise.resolve()

  .then(function () {
    return state.validate(doc)
  })
  .catch(function (rejectValue) {
    var error = new Error()

    if (rejectValue instanceof Error) {
      Object.keys(rejectValue).map(function (key) {
        error[key] = rejectValue[key]
      })

      if (rejectValue.message) {
github hoodiehq / hoodie-store-client / lib / push.js View on Github external
function push (state, docsOrIds) {
  var pushedObjects = []
  var errors = state.db.constructor.Errors

  return Promise.resolve(state.remote)

  .then(function (remote) {
    return new Promise(function (resolve, reject) {
      if (Array.isArray(docsOrIds)) {
        docsOrIds = docsOrIds.map(toId)
      } else {
        docsOrIds = docsOrIds && [toId(docsOrIds)]
      }

      if (docsOrIds && docsOrIds.filter(Boolean).length !== docsOrIds.length) {
        return Promise.reject(errors.NOT_AN_OBJECT)
      }

      var replication = state.db.replicate.to(remote, {
        create_target: true,
        doc_ids: docsOrIds,
github hoodiehq / hoodie-store-client / lib / validate.js View on Github external
function validate (state, doc) {
  if (state.validate === undefined) {
    return Promise.resolve()
  }

  return Promise.resolve()

  .then(function () {
    return state.validate(doc)
  })
  .catch(function (rejectValue) {
    var error = new Error()

    if (rejectValue instanceof Error) {
      Object.keys(rejectValue).map(function (key) {
        error[key] = rejectValue[key]
      })

      if (rejectValue.message) {
        error.message = rejectValue.message
      } else {
        error.message = 'document validation failed'