concept api in category javascript

appears as: APIs, API, n API, The API, APIs, The APIs, API
Deep Learning with JavaScript: Neural networks in TensorFlow.js

This is an excerpt from Manning's book Deep Learning with JavaScript: Neural networks in TensorFlow.js.

  • Compatible in API with Python deep-learning frameworks
  • Equipped with built-in support for data ingestion and with an API for visualization
  • This section is for readers who are interested in performing derivative and gradient calculation in TensorFlow.js. For most deep-learning models in this book, the calculation of derivatives and gradients is taken care of under the hood by model.fit() and model.fitDataset(). However, for certain problem types, such as finding maximally activating images for convolution filters in chapter 7 and RL in chapter 11, it is necessary to calculate derivatives and gradients explicitly. TensorFlow.js provides APIs to support such use cases. Let’s start from the simplest scenario—namely, a function that takes a single input tensor and returns a single output tensor:

    Front-End Tooling with Gulp, Bower, and Yeoman

    This is an excerpt from Manning's book Front-End Tooling with Gulp, Bower, and Yeoman.

    The local Gulp installation has two main purposes: loading and executing the building instructions written in the Gulpfile and exposing an API that can be used by the Gulpfile. The local Gulp installation is the actual software executing your builds. The global installation kicks off the local software installed separately for each project. Figure 2.4 illustrates this.

    Figure 2.4. The global installation of Gulp is the Gulp CLI. Its purpose is to check the availability of a local installation, which it starts on call. The local Gulp is located in the local node_modules folder of a JavaScript project. It contains all the necessary runtime functions and provides an API for build files (Gulpfiles).
    JavaScript Application Design: A Build First Approach

    This is an excerpt from Manning's book JavaScript Application Design: A Build First Approach.

    The book aims to get you thinking about practical design considerations made when building a real application, as well as deciding thoughtfully on the best possible tool for a job, all the while focusing on quality in both your processes and the application itself. When you set out to build an application, you start by determining the scope, choosing a technology stack, and composing a minimum viable build process. Then you begin building the app, maybe using an MVC architecture and sharing the view rendering engine in both the browser and the server, something we discuss in chapter 7. In chapter 9 you’ll learn the important bits on how to put an API together, and you’ll learn how to define backing services that will be used by both the server-side view controllers and the REST API.

  • Is the API used by several applications? Are the API and the front end developed by separate teams? Is there a drawn-out process to change an API endpoint? If any of these cases apply, you’re probably better off versioning your API.
  • Test cases can sometimes help as documentation by providing up-to-date working examples that also indicate best practices in accessing an API. Documentation enables API client developers to rapidly sift through any issues they may have because they didn’t fully understand the kind of data the API expected from them. Another desirable component in API documentation is a changelog that briefly details the changes that occur from one version to the next. Refer to section 4.2.2 for more information about changelogs.

    Node.js in Practice

    This is an excerpt from Manning's book Node.js in Practice.

    Node embraces non-blocking I/O as a way to improve performance in certain types of applications. JavaScript’s traditional event-based implementation means it has a relatively convenient and well-understood syntax that suits asynchronous programming. In a typical programming language, an I/O operation blocks execution until it completes. Node’s asynchronous file and network APIs mean processing can still occur while these relatively slow I/O operations finish. Figure 1.1 illustrates how different tasks can be performed using asynchronous network and file system APIs.

    The stream core module provides abstract tools for building event-based stream classes. It’s likely that you’ll use modules that implement streams, rather than creating your own. But to exploit streams to their fullest, it’s important to understand how they really work. This chapter has been designed with that goal in mind: understanding streams, working with Node’s built-in streaming APIs, and finally creating and testing your own streams. Despite the conceptually abstract nature of the stream module, once you’ve mastered the major concepts, you’ll start to see uses for streams everywhere.

    Single Page Web Applications: JavaScript end-to-end

    This is an excerpt from Manning's book Single Page Web Applications: JavaScript end-to-end.

    Listing 5.10. The people object API
    // The people object API // --------------------- // The people object is available at spa.model.people. // The people object provides methods and events to manage // a collection of person objects. Its public methods include: // * get_user() - return the current user person object. // If the current user is not signed-in, an anonymous person // object is returned. // * get_db() - return the TaffyDB database of all the person // objects - including the current user - pre-sorted. // * get_by_cid( <client_id> ) - return a person object with // provided unique id. // * login( <user_name> ) - login as the user with the provided // user name. The current user object is changed to reflect // the new identity. // * logout()- revert the current user object to anonymous. // // jQuery global custom events published by the object include: // * 'spa-login' is published when a user login process // completes. The updated user object is provided as data. // * 'spa-logout' is published when a logout completes. // The former user object is provided as data. // // Each person is represented by a person object. // Person objects provide the following methods: // * get_is_user() - return true if object is the current user // * get_is_anon() - return true if object is anonymous // // The attributes for a person object include: // * cid - string client id. This is always defined, and // is only different from the id attribute // if the client data is not synced with the backend. // * id - the unique id. This may be undefined if the // object is not synced with the backend. // * name - the string name of the user. // * css_map - a map of attributes used for avatar // presentation. //

    Now that we’ve completed a specification for the people object, let’s build it and test the API. After that, we’ll adjust the Shell to use the API so a user may sign in and sign out.

    Third-Party JavaScript

    This is an excerpt from Manning's book Third-Party JavaScript.

    To implement her dynamic resume, Jill uses Facebook’s Graph API. This is a web service API from Facebook that enables software applications to access or modify live Facebook user data (with permission, of course). Facebook also has a JavaScript library that provides functions for communicating with the API. Using this library, it’s possible for Jill to write client-side code that can find and display friends common to herself and a visitor to her resume. Figure 1.6 illustrates the sequence of events that occur between the browser and the two servers.

    GitHub, the popular source-code hosting service, is a terrific example of an API that supports CORS. Provided you’ve registered your website’s domain with their API, you can use XmlHttpRequest (XDomainRequest for Internet Explorer 8) to issue a cross-domain request from that domain. For example, we’ve registered thirdpartyjs.com (this book’s website) with GitHub’s API, which permits us to issue a CORS request from our website to their API. The following code snippet uses jQuery’s ajax helper to query information about the thirdpartyjs-code repository, where this book’s companion source code examples are hosted: