<commit_before>#Detector Elements

Each detector subsystem supported by MarkII has its own custom element for one-line deployment on a dashboard page.  
All detectors inherit most of their functionality from the `<detector-template>` object, and only detector-specific functionality is declared on the detector classes themselves; as such, this document focuses on the patterns established in `<detector-template>`, the `initializeDetector()` setup function, and the peripheral data these objects expect to have available when building a detector component.

####Contents
 - [Creation & Instantiation](https://github.com/GRIFFINCollaboration/griffinMarkII/tree/master/xTags/detectors#web-component-creation---lifecyclecreated)
 - [Participation in the Main Event Loop](https://github.com/GRIFFINCollaboration/griffinMarkII/blob/master/xTags/detectors/README.md#detectors-in-the-main-event-loop)
 - [Member Functions](https://github.com/GRIFFINCollaboration/griffinMarkII/tree/master/xTags/detectors#member-functions)
 - [Tooltip Infrastructure](https://github.com/GRIFFINCollaboration/griffinMarkII/tree/master/xTags/detectors#tooltip-infrastructure)
 - [JSONP Services & Callbacks](https://github.com/GRIFFINCollaboration/griffinMarkII/tree/master/xTags/detectors#jsonp-services--callbacks)
 - [HV Data Acquisition](https://github.com/GRIFFINCollaboration/griffinMarkII/tree/master/xTags/detectors#hv-data-acquisition)
 - [localStorage structure](https://github.com/GRIFFINCollaboration/griffinMarkII/tree/master/xTags/detectors#localstorage-structure)

##New Contributions
The following tries to lay as much out in as gory detail as possible, but for those of us that prefer examples, start by studying ZDS - this is the simplest possible detector page, and should be the first thing you master before building your own.  Minimal things needed to build a functioning detector page:

 - The detector x-tag.  See [ZDS](https://github.com/GRIFFINCollaboration/griffinMarkII/tree/master/static/xTags/detectors/ZDS) for a minimal example.
 - Add your detector to this list at the top of [xDetector.css](https://github.com/GRIFFINCollaboration/griffinMarkII/blob/master/static/xTags/detectors/xDetector.css)
 - A [Jade](http://jade-lang.com/) page template living [here](https://github.com/GRIFFINCollaboration/griffinMarkII/tree/master/views/detectors)
 - A [route](https://github.com/GRIFFINCollaboration/griffinMarkII/blob/master/routes.js) in the Node + Express app.
 - Autodetection of your detector from the MSC table [here](https://github.com/GRIFFINCollaboration/griffinMarkII/blob/master/static/xTags/nav/xNav.js)

##Web Component Creation - `lifecycle.created`
All custom web components execute a callback upon creation, found in `lifecycle.created` for each detector; this function declares a lot of detector-specific information, so it is left empty in the `<detector-template>` object, to be defined individually for each detector; nevertheless, `lifecycle.created` typically follows a standard pattern which we describe here:<commit_msg>relinked defunct old detector docs<commit_after>#Detector Elements

Each detector subsystem supported by MarkII has its own custom element for one-line deployment on a dashboard page.  
All detectors inherit most of their functionality from the `<detector-template>` object, and only detector-specific functionality is declared on the detector classes themselves; as such, this document focuses on the patterns established in `<detector-template>`, the `initializeDetector()` setup function, and the peripheral data these objects expect to have available when building a detector component.

####Contents
 - [New Contributions](https://github.com/GRIFFINCollaboration/griffinMarkII/tree/master/static/xTags/detectors#new-contributions)
 - [Creation & Instantiation](https://github.com/GRIFFINCollaboration/griffinMarkII/tree/master/static/xTags/detectors#web-component-creation---lifecyclecreated)
 - [Detectors in the Main Event Loop](https://github.com/GRIFFINCollaboration/griffinMarkII/tree/master/static/xTags/detectors#detectors-in-the-main-event-loop)
 - [Member Functions](https://github.com/GRIFFINCollaboration/griffinMarkII/tree/master/static/xTags/detectors#member-functions)
 - [Tooltip Infrastructure](https://github.com/GRIFFINCollaboration/griffinMarkII/tree/master/static/xTags/detectors#tooltip-infrastructure)
 - [JSONP Services & Callbacks](https://github.com/GRIFFINCollaboration/griffinMarkII/tree/master/static/xTags/detectors#json-services--callbacks)
 - [localStorage structure](https://github.com/GRIFFINCollaboration/griffinMarkII/tree/master/static/xTags/detectors#localstorage-structure)

##New Contributions
The following tries to lay as much out in as gory detail as possible, but for those of us that prefer examples, start by studying ZDS - this is the simplest possible detector page, and should be the first thing you master before building your own.  Minimal things needed to build a functioning detector page:

 - The detector x-tag.  See [ZDS](https://github.com/GRIFFINCollaboration/griffinMarkII/tree/master/static/xTags/detectors/ZDS) for a minimal example.
 - Add your detector to this list at the top of [xDetector.css](https://github.com/GRIFFINCollaboration/griffinMarkII/blob/master/static/xTags/detectors/xDetector.css)
 - A [Jade](http://jade-lang.com/) page template living [here](https://github.com/GRIFFINCollaboration/griffinMarkII/tree/master/views/detectors)
 - A [route](https://github.com/GRIFFINCollaboration/griffinMarkII/blob/master/routes.js) in the Node + Express app.
 - Autodetection of your detector from the MSC table [here](https://github.com/GRIFFINCollaboration/griffinMarkII/blob/master/static/xTags/nav/xNav.js)

##Web Component Creation - `lifecycle.created`
All custom web components execute a callback upon creation, found in `lifecycle.created` for each detector; this function declares a lot of detector-specific information, so it is left empty in the `<detector-template>` object, to be defined individually for each detector; nevertheless, `lifecycle.created` typically follows a standard pattern which we describe here:
{'fraction_non_alphanumeric': 0.09731489015459724, 'fraction_numerical': 0.0, 'mean_word_length': 5.709606986899563, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 24, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7637985', 'n_tokens_mistral': 1766, 'n_tokens_neox': 1726, 'n_words': 492}