Skip to content

Instantly share code, notes, and snippets.

@oeway
Last active June 17, 2018 09:56
Show Gist options
  • Save oeway/228a22a19899da7ac4084a4b781ae895 to your computer and use it in GitHub Desktop.
Save oeway/228a22a19899da7ac4084a4b781ae895 to your computer and use it in GitHub Desktop.
importScripts('https://rawgit.com/joewalnes/filtrex/master/filtrex.js')
class Filter {
constructor() {
this.default_expression = ''
}
async run(my){
const expression = my.data.filter_expression || this.default_expression;
const myfilter = compileExpression(expression)
return myfilter(my.target);
}
register(){
return {
name: "Filter",
type: "localization/filter",
tags: ["localization", "action"],
init: "Filter the image with {id:'filter_expression', type:'string', placeholder:''}",
onact: this.run
}
}
}
api.export(new Filter())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment