Creating a PhoneGap plugin doesn’t have to be scary, and it isn’t all that difficult! In this workshop you’ll learn how to create a simple plugin, how to structure your plugin for multi-platform support, how to add it to your projects, and how to test it thoroughly using Cordova’s plugin testing framework.

Note: Presentation and Workshop based in part on PGDay EU 2016 plugin workshop by Jesse

Presenters

About Kerri

About Jesse

Prerequisites

The following prerequisites are required. Versions used for testing follow.

Let’s get started!

  1. What is a plugin? — What a plugin is; what plugins can do; plugin categories
  2. Managing plugins — Installing from npm, git, local file system; finding plugins
  3. Plugin X-Ray — What’s inside a plugin (metadata, documentation, structure, etc.)
  4. Know your bridges — iOS, Android, Browser & Windows
  5. Creating a plugin (four parts) — Creating a plugin scaffold; JS API; native code; class mapping
  6. Testing — Testing your plugin with cordova-paramedic, Jasmine; tips
  7. Debugging and Iterating — Linking your plugin; using the native SDK’s IDEs
  8. Publishing — Publishing to npm
  9. Hooks — What a hook is, what hooks can do, and ideas
  10. Tips — Useful tips to remember
  11. Homework — Using what you’ve learned; ideas

Our Final Plugin

You can see code for the final plugin created for this workshop at https://github.com/kerrishotts/cordova-plugin-example-isprime.

Sources


Navigation: