Flow Functions

search()

"search" will execute when a search query is performed on the script via the Otto search bar.

let result_1 = null; // Keep track of those if you want to re-use them on query updates
let result_2 = null;
let result_3 = null;
const prefixes = ['hello'];

search(prefixes, (query, callback) => {

	var result_1 =  {
		uid: 'result_1_unique_id',
		label: 'World',
		subtext: 'This is a subtext for query: ' + query,
		is_note: true,
		execute: () => {
			// Do something when clicked
			return false; // Omit or false to close Otto, true to keep it open;
		}
	};

	var result_2 =  {
		uid: 'result_2_unique_id',
		label: 'World',
		image: 'https://github.com/parallel42/flow-documentation/raw/main/flow_logo.svg',
		subtext: 'This is a subtext for query: ' + query,
		execute: () => {
			// Do something when clicked
			return false; // Omit or false to close Otto, true to keep it open;
		}
	};

	var result_3 =  {
		uid: 'result_3_unique_id',
		label: 'Long World',
		subtext: '<p>This is a long text... it can also be wrapped in html</p>',
		execute: null,
		image: 'https://en.wikipedia.org/wiki/Google_logo#/media/File:Google_2015_logo.svg',
		is_text: true
	};

	callback([result_1, result_2, result_3]); // Callback can be called multiple times if results need to be renerated asynchronously but must always include the list of all results.
});

prefixes: Array list of prefixes to trigger the search (like the default metar and tod searches).
query: String of the entire query (content of the Otto search bar).
callback: Is used to return of list of the results in the format specified in the example.

Community of Makers

Our Discord has evolved into a vibrant hub for widget creators. Seek answers to your questions, and showcase your innovative widgets to a community of passionate makers.