npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@akeating-redhat/fh-js-sdk

v2.18.2

Published

feedhenry js sdk

Downloads

14

Readme

FeedHenry JavaScript SDK

Build Status

The JavaScript SDK allows developers to integrate the FeedHenry Cloud into any web-based solution - desktop websites, mobile websites or a stand-alone JavaScript client.

The API is provided in the $fh namespace and uses a common convention for most functions, which takes the format:

$fh.doSomething(parameterObject, successFunction, failureFunction)

Where parameterObject is an ordinary JavaScript object. The successFunction callback is called if the operation was successful and the failureFunction callback is called if the operation fails. All of these arguments are optional. If there is only one function, it is taken as the success function.

The successFunction callback is called with one argument, a result object, which is again an ordinary JavaScript object. The failureFunction callback is called with two arguments: an error code string, and an object containing additional error properties (if any).

Detailed documentation for the JavaScript SDK's API can be found here: http://docs.feedhenry.com/v3/api/app_api

Using with Titanium Applications

The FeedHenry Javascript SDK is built to work with Titanium applications. To get started, you need to first include the FeedHenry JS SDK, feedhenry.js in your Resources folder, at the root level. You also need to include a fhconfig.js file, which sets configuration properties for initializing the JS SDK. This file is a little different than normal, it should take the format of:

module.exports = {
 "appid":"yourAppIdHere",
 "appkey":"yourAppKeyHere",
 "connectiontag":"yourConnectionTagHere",
 "host":"https://YourHost.feedhenry.com",
 "projectid":"yourProjectIdHere"
};

You can then require the FeedHenry SDK from any JavaScript file in your Titanium project, and use it as normal:

var $fh = require('feedhenry');
$fh.act // ...FeedHenry Calls are now possible

For a practical exampe, see the FeedHenry Titanium example app.

Building

The JS SDK is now built using Browserify.

Development

Because of Browserify, you can write any new functions as normal node modules, and use node's "require" to load any other modules, or to be consumed by other modules.

Testing

Write your tests in test/tests directory. Add the tests to test/browser/suite.js file and run

grunt test

This will use mocha and phatomjs to run the tests.

In fact, if your module and test don't require a browser environment, you can just run them purely in node. (You may need to add a new grunt task to run them).

To help debugging, you can run

grunt local

This will start mock servers locally and you can go to http://localhost:8200/example/index.html page to debug. You may want to run

grunt watch

In another terminal window to auto generate the combined js sdk file.

Testling

For browser compatibility testing, we use Testling. The project page is here: https://ci.testling.com/feedhenry/fh-js-sdk.

You can also run testling locally:

npm install -g testling
testling

If testling can not find any browser locally, you either need to add browser paths to your PATH environment variable, or use

testling -u

and copy the url to a browser.

Build

When finish developing and testing, run

grunt

To generate the release builds.

Updating the AppForms Template App

This process should be changed, however, documenting it here.

Build the js-sdk as above. clone the AppForms-Template repo

git clone [email protected]:feedhenry/AppForms-Template.git

switch to the feedhenry3 branch

git checkout feedhenry3

copy the appForms-backbone file generated in the js-sdk to the AppForms-Template

cp fh-js-sdk/dist/appForms-backbone.js AppForms-Template/client/default/lib/appform-backbone.js

install the node modules in the AppForms-Template

cd AppForms-Template
npm install

and run grunt

grunt

clone the app forms-project-client template app

git clone git://github.com/feedhenry/appforms-project-client.git

copy the resulting lib.min.js to the appforms template

cp AppForms-Template/dist/client/default/lib.min.js appforms-project-client/www/lib.min.js

push the updated changes

git push origin master

Releasing

Our SDK is release on npmjs. To do a release follow those steps:

Prepare release

  • Update package.json, npm-shrinkwrap.json, file with the new version number.
  • Update CHANGELOG.md with some JIRA link
  • Do a PR, make sure Travis build passed. Merge.
  • Tag the repository with the new version number:
git tag -s -a {VERSION} -m 'version {VERSION}'   // e.g. {VERSION} format is  '2.17.0'
  • Push the new release tag on GitHub:
git push origin {TAG}

Publish to npmjs

  • Login to npm as feedhenry or make sure your own login is part of the collaborator list in fh-js-sdk in npmjs.org
npm login
  • Publish:
npm publish