See the JS tab for the code and browser console for messages
- publish true on a boolean signal named ex1_b - publish 3 on a numeric signal named ex1_n - publish New York on a string signal named ex1_s
- publish false on a boolean signal named ex1_b - publish 11 on a numeric signal named ex1_n - publish London on a string signal named ex1_s
<p>See the JS tab for the code and browser console for messages</p> <div> <ch5-button id="ex1-btn1" label="Btn1" ></ch5-button> Clicking this button will:<pre> - publish <b>true</b> on a boolean signal named ex1_b - publish <b>3</b> on a numeric signal named ex1_n - publish <b>New York</b> on a string signal named ex1_s </pre> </div> <div> <ch5-button id="ex1-btn2" label="Btn2" ></ch5-button> Clicking this button will:<pre> - publish <b>false</b> on a boolean signal named ex1_b - publish <b>11</b> on a numeric signal named ex1_n - publish <b>London</b> on a string signal named ex1_s </pre> </div>
(function(CrComLib){ var btn1=document.querySelector('#ex1-btn1'); var btn2=document.querySelector('#ex1-btn2'); btn1.addEventListener('click',btn1Click); btn2.addEventListener('click',btn2Click); function btn1Click(){ CrComLib.publishEvent('b','ex1_b',true); CrComLib.publishEvent('n','ex1_n',3); CrComLib.publishEvent('s','ex1_s','New York'); } function btn2Click(){ CrComLib.publishEvent('b','ex1_b',false); CrComLib.publishEvent('n','ex1_n',11); CrComLib.publishEvent('s','ex1_s','London'); } })(CrComLib);