1414 * @exports SocialShare
1515 */
1616
17- import base from "@loltgt/ ensemble" ;
17+ import base from ' ensemble' ;
1818
1919
2020/**
@@ -39,7 +39,7 @@ const SocialShareActionEnum = Object.freeze({
3939 * @extends base
4040 * @inheritdoc
4141 * @param {Element } [element] A valid Element node placeholder to replace with the component
42- * @param {object } options Options object
42+ * @param {object } [ options] Options object
4343 * @param {string } [options.ns=share] The namespace for social share
4444 * @param {string } [options.root=body] A root Element node
4545 * @param {string[] } [options.className=social-share] The component CSS class name
@@ -202,8 +202,8 @@ class SocialShare extends base {
202202 super ( ...arguments ) ;
203203
204204 /**
205+ * Alias for encodeURIComponent
205206 * @see encodeURIComponent
206- *
207207 * @name encoder
208208 * @function
209209 */
@@ -248,9 +248,10 @@ class SocialShare extends base {
248248 this . drawer ( ) ;
249249
250250 /**
251+ * options.onInit callback
251252 * @event #options.onInit
252253 * @type {function }
253- * @param {object } this
254+ * @param {object } this This component object
254255 */
255256 opts . onInit . call ( this , this ) ;
256257 }
@@ -417,12 +418,13 @@ class SocialShare extends base {
417418 const data = { url, title, text, summary} ;
418419
419420 /**
421+ * options.onIntent callback
420422 * @event #options.onIntent
421423 * @type {function }
422- * @param {object } this
423- * @param {Event } evt
424- * @param {string } intent
425- * @param {object } data
424+ * @param {object } this This component object
425+ * @param {Event } evt Event object
426+ * @param {string } intent Current intent
427+ * @param {object } data Sharing data object
426428 */
427429 opts . onIntent . call ( this , this , evt , intent , data ) ;
428430
@@ -451,9 +453,7 @@ class SocialShare extends base {
451453 * @return {string } URL encoded text string
452454 */
453455 text ( data ) {
454- const encoder = this . encoder ;
455-
456- return encoder (
456+ return this . encoder (
457457 data . text
458458 . replace ( '%url%' , data . url )
459459 . replace ( '%title%' , data . title )
@@ -512,11 +512,11 @@ class SocialShare extends base {
512512 * @param {string } data.summary Share summary text
513513 */
514514 sendEmail ( evt , data ) {
515- const { options : opts , encoder } = this ;
515+ const opts = this . options ;
516516 const locale = opts . locale ;
517517
518518 const url = opts . uriform [ 'send-email' ]
519- . replace ( '%subject%' , encoder ( locale . subject ) )
519+ . replace ( '%subject%' , this . encoder ( locale . subject ) )
520520 . replace ( '%text%' , this . text ( data ) ) ;
521521
522522 window . open ( url , '_self' ) ;
0 commit comments