SuggestGrid JavaScript Clients
SuggestGrid has JavaScript clients that can be used by any web browser, RequireJS, Node.js, CommonJS, jQuery, and EcmaScript 6 module systems. These are frontend clients.
Note that SuggestGrid Node.js Client is available for JavaScript backends. In addition, SuggestGrid REST API is the most basic choice.
API
These clients are made for public usage in mind. API keys used in browsers are exposed to the public. Therefore, we strongly request our clients to use their public keys for these clients.
Moreover, only the API methods that can be accessed by public keys are available in SuggestGrid JavaScript clients. Only single action post, recommendation, and similarity methods are available.
Usage
SuggestGrid JavaScript clients are available under dist folder. Minimized clients are also available there.
SuggestGrid JavaScript Client is also available on npm: suggestgrid-js. Notice that this version has only public method implementations.
Below are example implementations of SuggestGrid JavaScript clients. These examples demonstrate how to send an action to SuggestGrid on a click of a button.
suggestgrid.js
SuggestGrid JavaScript Client:This is the standard SuggestGrid JavaScript client. It is a UMD implementation, therefore can be consumed by many module loaders.
Examples:
suggestgrid.es6.js
SuggestGrid EcmaScript 6 Client:This is the SuggestGrid client of the bright future of JavaScript! Use it if you can! The example is demonstrated with SystemJS.
Microsoft Edge can load EcmaScript 6 modules if its experimental features are enabled [1]. browser-es-module-loader project can be used to load modules in other browsers.
Example:
suggestgrid.jquery.js
SuggestGrid jQuery Plugin:This is the SuggestGrid jQuery plugin. It has the same functionality with the standard SuggestGrid JavaScript client, but it makes jQuery requests.
Example:
Development
Build Process
In order to create a modular structure without duplications, SuggestGrid clients are created by merging small JavaScript snippets.
The clients are created by the snippets in src folder by build.sh script. This is the command triggered by npm build
command.
Update the Client
One changes are made the following commands would publish it on a patch version upgrade:
npm build
npm version patch
npm push
npm publish
License
The MIT License (MIT) – Copyright (c) 2016 SuggestGrid