Skip to main content

Home

Workers plugin for WILL SDK for ink

This plugin provides async ink processing. The following workers can extend the ink experience:

  • ink-path-provider - Worker manager that's represented from the class 'ConvexHullProducer'. It is responsible for the processing of splines and producing rendering paths.
  • convex-hull-provider - Worker manager that's represented from the class 'ConvexHullProducer'. It is responsible for the processing of convex hulls and producing convex hull paths.
  • split-points-provider - Worker manager that's represented from the class 'SplitPointsProducer'. It is responsible for the processing of split points generated from Intersector, which results in spline segments.

Integration​

WILL SDK for ink expects the plugin to be installed first. PluginsManager static property DEPENDENCIES_SRC defaults to '/node_modules'.

import {PluginsManager} from "digital-ink"// import in webpack envimport factory from "@digital-ink/workers"// init application callbackasync init() { ... // mjs const workers = await PluginsManager.installWorkers() // webpack const workers = PluginsManager.connectWorkers(factory) ...}

workers namespace (install result)​

  • provides const string version
  • provides namespace workers when loaded - allows multi-threading

Webpack configuration​

The workers' nature doesn't allow bundling. Every worker is a self-sufficient program; the webpack would treat @digital-ink/workers as an external dependency.

To provide visibility to workers, they should be accessible from the webpack env. The webpack configuration should be extended. This configuration targets the copy-webpack-plugin plugin.

/* package.json */"devDependencies": { ... "copy-webpack-plugin": "^11.x"}

Let's update webpack configuration.

/* config-overrides.js */const webpack = require("webpack");const CopyPlugin = require("copy-webpack-plugin");module.exports = function override(config, env) { if (!config.eternals) { config.externals = []; } if (!config.plugins) { config.plugins = []; } config.externals = [...config.externals, "bindings", "worker_threads"]; config.plugins.push( new CopyPlugin({ patterns: [ { from: "node_modules/@digital-ink/workers/workers", to: "static/js/workers" } ] }) ); return config;}

License​

End user license agreement for Wacom Ink SDK

Home​