@jean-moldovan jean-moldovan released this Jan 11, 2017 · 4 commits to master since this release

Assets 2

v2.0.0 (11-01-2017)

Breaking changes

  • implicitScans: implicitScans are not created automatically when scanning an image.
  • Options: type, timeout, threshold, redirect, createScanAction and spinner options have been removed.
    See README for more information on how to use custom spinner.

Features

  • Options: Use filter option to filter out results based on method and type
app.scan({
  filter: {
    type: 'image'
  }
});
  • Options: Use debug option to include debug information in response.
  • Options: Use perPage option to specify max number of matches in response.
  • identify: .identify method is now available on the app and allows to get Thng/product infromation
    associated with provided value:
app.identify({
  filter: {
    type: 'text',
    value: 'value'
  }
});
  • redirect: Redirect to url provided app.redirect('https://evrythng.com')

Migrating

The breaking changes included in this version aim to make evrythng-scan.js and the corresponding API service more explicit and flexible for developers:

  • The SDK no longer creates implicit scan actions and scan actions automagically. The developer is now in control of the scanning flow, determining what type of action to do (e.g. create a _register custom action with custom fields) and when (e.g. process the results before creating action and/or redirecting to another URL):
    • Implicit scan actions are the result of an implicit server redirection when getting the thng/product short url (tn.gg/xxx). This can be achieved by calling app.redirect(result.redirections[0]).
    • Explicit actions are defined by the developer according to the application's business logic. These can made by calling result.thng.action('_register').create(<customAction>) (the previous default type was 'scans').
  • The results format is now consistent with the API service response and easier to reason about. It is the same regardless of options and number of matched results.
  • The external spinner library is no longer bundled in the SDK. Developers must use their own visual hint for the loading state, or include the previous spinner library explicitly (see Spinner).
  • Service API and format of response can be viewed here.