Connect widget is essentially a connection JS-scripts on certain pages (interfaces) amoCRM. This can't be done at all, but only on a certain list of screens.
The names of all areas listed below:
|lcard, cucard, ccard, comcard
Leads, customers, contacts and companies cards
|llist, culist, clist, tlist
Lists of leads, customers, contacts, and tasks
Page install and configure widgets
Our system must provide information about the areas in which the widget is displayed, and where it will be use the right-hand column. To do this, in the block "locations" file manifest.json should list the areas indicating 1 or 0 after the name as a parameter to the use of the right column (the default is 1).
For example, this widget will be initialized to the settings page in the cards and lists of contacts and leads, but use the right-hand column is only in these cards:
In addition, an indication of true or false in the block "init_once" file manifest.json regulates the opportunity each time transition from the region to cause init() function and bind_actions(), or call them only once. For example, phone widgets constantly keep WebSocket connection and it should not be broken, so init_once must be set to true. If the total for all pages of context is not, it is better to put in false.
Please note that JS widget code may be "is hung" on certain events. There is a certain specificity for dealing with events in the cards and lists.
When JS is loaded, callback function render(), and then init() and bind_actions() will be called. When initializing the widget in areas ccard or lcard right column with widget appears immediately, and at managing the list, right-hand column and widget add to the page on "selected" event — fires corresponding callback function in script.js. This function introduction is called when the user selects the desired table rows using checkbox, and then selecting the widget in the context menu. The context menu appears using at least one checkbox.