How to use the kew.fcall function in kew

To help you get started, we’ve selected a few kew 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 sx1989827 / DOClever / node_modules / phantomjs-prebuilt / install.js View on Github external
function tryPhantomjsInLib() {
  return kew.fcall(function () {
    return findValidPhantomJsBinary(path.resolve(__dirname, './lib/location.js'))
  }).then(function (binaryLocation) {
    if (binaryLocation) {
      console.log('PhantomJS is previously installed at', binaryLocation)
      exit(0)
    }
  }).fail(function () {
    // silently swallow any errors
  })
}
github Medium / phantomjs / install.js View on Github external
function tryPhantomjsInLib() {
  return kew.fcall(function () {
    return findValidPhantomJsBinary(path.resolve(__dirname, './lib/location.js'))
  }).then(function (binaryLocation) {
    if (binaryLocation) {
      console.log('PhantomJS is previously installed at', binaryLocation)
      exit(0)
    }
  }).fail(function () {
    // silently swallow any errors
  })
}
github volumio / Volumio2 / app / plugins / music_services / mpd / index.js View on Github external
ControllerMpd.prototype.parsePlaylist = function(objQueue) {
	var self = this;
	self.commandRouter.pushConsoleMessage('[' + Date.now() + '] ' + 'ControllerMpd::parsePlaylist');

	// objQueue is in form {'0': 'file: http://uk4.internet-radio.com:15938/', '1': 'file: http://2363.live.streamtheworld.com:80/KUSCMP128_SC'}
	// We want to convert to a straight array of trackIds
	return libQ.fcall(libFast.map, Object.keys(objQueue), function(currentKey) {
		return convertUriToTrackId(objQueue[currentKey]);
	});
};
github wires / gulp-static-site / index.js View on Github external
var compile_template = function (filename) {
    return Q
      .fcall(function () {
        // return cached immediately
        if (cache[filename]) {
          return cache[filename]
        }

        // (asynchronously) load and compile template
        $.util.log('loading template: ' + filename)
        return Q
          .nfcall(fs.readFile, filename)
          .then(function (tmpl_content) {
            // turn template in promise returning function and cache it
            var compiled = jade.compile(tmpl_content, {pretty: true, filename: filename})
            $.util.log('compiled template: ' + chalk.yellow(filename))
            return (cache[filename] = compiled)
          })
github volumio / Volumio2 / app / plugins / user_interfaces / websocket / index.js View on Github external
InterfaceWebUI.prototype.pushLibraryListing = function(browsedata, connWebSocket) {
	var self = this;
	self.commandRouter.pushConsoleMessage('[' + Date.now() + '] ' + 'InterfaceWebUI::pushLibraryListing');

	// If a specific client is given, push to just that client
	if (connWebSocket) {
		return libQ.fcall(libFast.bind(connWebSocket.emit, connWebSocket), 'pushLibraryListing', browsedata);
	}
}
github volumio / Volumio2 / app / plugins / user_interfaces / websocket / index.js View on Github external
InterfaceWebUI.prototype.pushState = function(state, connWebSocket) {
	var self = this;
	self.commandRouter.pushConsoleMessage('[' + Date.now() + '] ' + 'InterfaceWebUI::pushState');
	if (connWebSocket) {
		self.pushMultiroom(connWebSocket);
		return libQ.fcall(libFast.bind(connWebSocket.emit, connWebSocket), 'pushState', state);

	} else {
		// Push the updated state to all clients
		self.pushMultiroom(self.libSocketIO);
		return libQ.fcall(libFast.bind(self.libSocketIO.emit, self.libSocketIO), 'pushState', state);
	}
}
github volumio / Volumio2 / app / plugins / music_service / mpd / index.js View on Github external
ControllerMpd.prototype.parsePlaylist = function (objQueue) {
	var self = this;
	self.commandRouter.pushConsoleMessage('ControllerMpd::parsePlaylist');

	// objQueue is in form {'0': 'file: http://uk4.internet-radio.com:15938/', '1': 'file: http://2363.live.streamtheworld.com:80/KUSCMP128_SC'}
	// We want to convert to a straight array of trackIds
	return libQ.fcall(libFast.map, Object.keys(objQueue), function (currentKey) {
		return convertUriToTrackId(objQueue[currentKey]);
	});
};
github volumio / Volumio2 / app / plugins / user_interface / websocket / index.js View on Github external
InterfaceWebUI.prototype.pushState = function (state, connWebSocket) {
	var self = this;
	self.commandRouter.pushConsoleMessage('[' + Date.now() + '] ' + 'InterfaceWebUI::pushState');
	if (connWebSocket) {
		self.pushMultiroom(connWebSocket);
		return libQ.fcall(connWebSocket.emit.bind(connWebSocket), 'pushState', state);

	} else {
		// Push the updated state to all clients
		self.pushMultiroom(self.libSocketIO);
		return libQ.fcall(self.libSocketIO.emit.bind(self.libSocketIO), 'pushState', state);
	}
};
github Medium / dynamite / test / testBatchGetItem.js View on Github external
builder.add(function testBatchGetBadKey(test) {
  var client = this.client
  return Q.fcall(
    function () {
      return client.newBatchGetBuilder()
        .setPrefix('pre_')
        .requestItems('many', manyData.map(function () { return {'hashKey': {}, 'column': '@'}}))
        .execute()
    })
    .then(function () {
        test.fail('Expected error')
    })
    .fail(function (err) {
      if (err.message != 'Invalid dynamo value. Type: object, Value: [object Object]') throw err
    })
})
github Medium / phantomjs / lib / util.js View on Github external
function findValidPhantomJsBinary(libPath) {
  return kew.fcall(function () {
    var libModule = require(libPath)
    if (libModule.location &&
        getTargetPlatform() == libModule.platform &&
        getTargetArch() == libModule.arch) {
      var resolvedLocation = path.resolve(path.dirname(libPath), libModule.location)
      if (fs.statSync(resolvedLocation)) {
        return checkPhantomjsVersion(resolvedLocation).then(function (matches) {
          if (matches) {
            return kew.resolve(resolvedLocation)
          }
        })
      }
    }
    return false
  }).fail(function () {
    return false

kew

a lightweight promise library for node

Apache-2.0
Latest version published 9 years ago

Package Health Score

59 / 100
Full package analysis