add Pattern.id + use it for _punchcard and _spiral

This commit is contained in:
Felix Roos 2024-03-23 12:06:31 +01:00
parent 2cc92a2b93
commit 2857e816d2
4 changed files with 25 additions and 6 deletions

View file

@ -2487,6 +2487,15 @@ export const { color, colour } = register(['color', 'colour'], function (color,
return pat.withContext((context) => ({ ...context, color }));
});
/**
* Sets the id of the hap in, for filtering in the future.
* @name id
* @noAutocomplete
* @param {string} id anything unique
*/
Pattern.prototype.id = function (id) {
return this.withContext((ctx) => ({ ...ctx, id }));
};
//////////////////////////////////////////////////////////////////////
// Control-related functions, i.e. ones that manipulate patterns of
// objects