{"_id":"@financial-times/o-comment-utilities","_rev":"29-245d4766d488941d6c5b3b46a997a886","name":"@financial-times/o-comment-utilities","dist-tags":{"latest":"2.4.3"},"versions":{"2.4.0":{"name":"@financial-times/o-comment-utilities","version":"2.4.0","keywords":["origami","component","ft"],"_id":"@financial-times/o-comment-utilities@2.4.0","maintainers":[{"name":"chee","email":"chee@snoot.club"},{"name":"briggsc","email":"charlie.briggs@bbc.co.uk"},{"name":"the-ft","email":"strategic.products+npm@ft.com"},{"name":"quarterto","email":"matt@153.io"},{"name":"rowanmanning","email":"accounts@rowanmanning.co.uk"},{"name":"mattandrews","email":"matt@mattandre.ws"},{"name":"jakedchampion","email":"me@jakechampion.name"},{"name":"i-like-robots","email":"matt+npm@maketea.co.uk"},{"name":"aendrew","email":"aendrew@aendrew.com"},{"name":"sdbernard","email":"steve.bernard@ft.com"},{"name":"bobhaslett","email":"bob.haslett@ft.com"},{"name":"joannaskao","email":"joannaskao@gmail.com"},{"name":"robinmarr-ft","email":"robin.marr@ft.com"},{"name":"ft-internal-products","email":"ip.engineering@ft.com"}],"dist":{"shasum":"3fdac7ce458c4ddc5fa7f117fa8a2d5267ce1ba3","tarball":"https://registry.npmjs.org/@financial-times/o-comment-utilities/-/o-comment-utilities-2.4.0.tgz","fileCount":43,"integrity":"sha512-gjde+hLbb8iJDnEHp+uCYCZzMGF5MFFFDpo6J76WMy4F2AU1cIEZKNVxigW5ji62AwQTZlwNk4vFbVLLMZqe7A==","signatures":[{"sig":"MEQCIFs0BYijr4a15bVysMn4lEID7G/vxf4v+F+kDyaFVov1AiAedFkiyZISdtKfiljt0vvomCTTzDQZj/6OMM8K+b3kiA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":86280,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcbEMqCRA9TVsSAnZWagAAPYQP/ArjEakyYiN8M5rYUQdB\nYANWlH0VHpFBmLXw6pil1J3gJukZb9hDeUG/he+GWfb+3krC2U6e6JFv3v0/\nz8WY7hD7aF1kMAmBYguzEnXZox7zotY+rF6066E3SxdMoJnRRQsbShh+Kn6B\nZYoryrxzpMj79sd9HV3APRlC/YyOZoGyZCzFwC5aLbFqvYsIaRQpdoj3UNkl\noDlFmdpoaCplyn74o9nyQkyTIGQK+WPJ3WG5qHFHlOJm1msVWUCnvofgg1er\ng/xYO8NOaeuLSvTMZinQejCne6B0fGRI7Ml8uzdorEEnF9q55LsNP+EhVm7L\noF9qxzNWtoY4vSNybVMpkRsNFUGl8tvApb8uxA7Vs0fFLIt/lnC6ltlfCYwT\nc1OfFTcEx7W/mns+c6R5fo5jn2Su6g+yCYz/YYshUk3xXd5c5Z3+ob/WKDLs\n7LW7ZWVUVksg6AJJEVUlcmxHjq0k0W5TGptUmlMHZkA90gKw9GZp2q75XMJD\nMpoZGJ7Fey4rXFV/bshBBP2v8INyBecSCw2cT6jWQ6b4gKoynqtFuII/8dmC\nbI6QIlQCks5vJwQiAGQhjvCqR0t5fTW/CEpGwDJX397Jbk8Pke/DHjNAvghx\n5dadfhG0BZcYPUtj3a9zjCRjvzRBakW6jy4o+LV/H0me8TXyeUXfBehnAjma\nxf65\r\n=SxRv\r\n-----END PGP SIGNATURE-----\r\n"},"browser":"browser.js","gitHead":"dbfa1039f1887ef184afd8b9419343671c40b976","scripts":{},"_npmUser":{"name":"the-ft","email":"strategic.products+npm@ft.com"},"component":"o-comment-utilities","_npmVersion":"6.4.1","description":"A collection of helper functions used by o-comments and o-chat.","directories":{},"_nodeVersion":"10.15.1","dependencies":{},"eslintIgnore":["browser.js","dist/"],"_hasShrinkwrap":false,"devDependencies":{},"_npmOperationalInternal":{"tmp":"tmp/o-comment-utilities_2.4.0_1550598953559_0.8735905687408834","host":"s3://npm-registry-packages"}},"2.4.1":{"name":"@financial-times/o-comment-utilities","version":"2.4.1","keywords":["origami","component","ft"],"_id":"@financial-times/o-comment-utilities@2.4.1","maintainers":[{"name":"aendrew","email":"aendrew@aendrew.com"},{"name":"axgy","email":"a@ax.gy"},{"name":"bobhaslett","email":"bob.haslett@ft.com"},{"name":"briggsc","email":"charlie.briggs@bbc.co.uk"},{"name":"chee","email":"chee@snoot.club"},{"name":"conor-mullen","email":"conor.mullen@ft.com"},{"name":"ft-internal-products","email":"ip.engineering@ft.com"},{"name":"i-like-robots","email":"matt+npm@maketea.co.uk"},{"name":"jakedchampion","email":"me@jakechampion.name"},{"name":"joannaskao","email":"joannaskao@gmail.com"},{"name":"mattandrews","email":"matt@mattandre.ws"},{"name":"notlee","email":"lee@leemoody.co.uk"},{"name":"quarterto","email":"bren@153.io"},{"name":"robinmarr-ft","email":"robin.marr@ft.com"},{"name":"rowanmanning","email":"accounts@rowanmanning.co.uk"},{"name":"sdbernard","email":"steve.bernard@ft.com"},{"name":"tatiana.stantonian","email":"tatiana.stantonian@ft.com"},{"name":"the-ft","email":"strategic.products+npm@ft.com"}],"homepage":"https://github.com/Financial-Times/o-comment-utilities#readme","bugs":{"url":"https://github.com/Financial-Times/o-comment-utilities/issues"},"dist":{"shasum":"144c5bf9df54851f0574ee040f0d31b906568591","tarball":"https://registry.npmjs.org/@financial-times/o-comment-utilities/-/o-comment-utilities-2.4.1.tgz","fileCount":43,"integrity":"sha512-jESCCNfrTvIrN0HH/a7VjmFFwds79nTguLi/TD5oNaJTT633/gTmY/8il1ohUUjmGyclF3SDU+73xSPHsuZDpw==","signatures":[{"sig":"MEYCIQCcCQMjtrKt5R4VwA6ktIVa2rc5GB39G45pfuToqLx9FAIhAM9XYCH7fo0BF7N0fQ1Idq+3Nmd9Qe/YOoqw7ox+iSHe","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":85235,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeefEqCRA9TVsSAnZWagAAL+0P/0lFQ+QylCMu0MpBuIQu\nz68hdQala9Q7+xsGdZGjNMDtUijXRRuivmQ7PXDYtgJMoThvLxszTPD77xax\nrH9RURlx06pIBqCuXB6ad8PSOgAikEHC9zv89lgF8RBypc6XY+7F1OASAwbw\n2ctIfydS+caezBVt5K045V78p1ABYeNDXVOsrP5+WgRlsRlHF5wCbW64W4KS\nYjK4KQe4ck1NSc6T/Ee7r9JLFD7FK9HJBsqf32DQ9paz1LiLtMrWvdGbS935\nAE7l9WtF17QDgx9wEylYkM/qErrWnNks9ZLrbD4I3TCZAiUi9Znt73dHftvV\n4EM6O9aaFFsvCQlomMmiYy4bqzpsrUlVF4d/jCFi9Ne/P9C556F9WBB8vaCt\nDkTpWj3SVWWjvK0+HB2LmjwreV+kU5Kh8htSyJULS2eGDSbF1wzagYNlRmfs\nZXx18jPwWDj062OtbGCQO+kQtjUfBvLD1suwqxEidCx56/Kk+9m/QMlSFeIB\nobY6NKO5z9pH/QGitBmnFmP5U9JAHK8uECxQgsb3XQ0QDfEiTea55RQdYqOR\nn7yVIE/tqpSAhiqVxQj+R6KfKSgwo59U+SjP8Z07Ah6X8/6cIF5lMsta0i+E\n4dklHm+MvlVClAknAqxKLaLnnjBGCfYoeXq12Adr/GHixsEd6W3dCdKXrZeQ\n3WAP\r\n=+vfH\r\n-----END PGP SIGNATURE-----\r\n"},"browser":"browser.js","gitHead":"c4b0a3af3d255f80649ffa9273be7aafa4620cc1","scripts":{},"_npmUser":{"name":"the-ft","email":"strategic.products+npm@ft.com"},"component":"o-comment-utilities","repository":{"url":"git+ssh://git@github.com/Financial-Times/o-comment-utilities.git","type":"git"},"_npmVersion":"6.13.4","description":"A collection of helper functions used by o-comments and o-chat.","directories":{},"_nodeVersion":"10.19.0","dependencies":{},"eslintIgnore":["browser.js","dist/"],"_hasShrinkwrap":false,"devDependencies":{"origami-ci-tools":"^1.0.0","eslint-config-origami-component":"^2.0.1"},"_npmOperationalInternal":{"tmp":"tmp/o-comment-utilities_2.4.1_1585049897955_0.10268975917872125","host":"s3://npm-registry-packages"}},"2.4.2":{"name":"@financial-times/o-comment-utilities","version":"2.4.2","keywords":["origami","component","ft"],"_id":"@financial-times/o-comment-utilities@2.4.2","maintainers":[{"name":"aendrew","email":"aendrew@aendrew.com"},{"name":"axgy","email":"a@ax.gy"},{"name":"bobhaslett","email":"bob.haslett@ft.com"},{"name":"briggsc","email":"charlie.briggs@bbc.co.uk"},{"name":"chee","email":"chee@snoot.club"},{"name":"conor-mullen","email":"conor.mullen@ft.com"},{"name":"ft-internal-products","email":"ip.engineering@ft.com"},{"name":"i-like-robots","email":"matt+npm@maketea.co.uk"},{"name":"jakedchampion","email":"me@jakechampion.name"},{"name":"joannaskao","email":"joannaskao@gmail.com"},{"name":"mattandrews","email":"matt@mattandre.ws"},{"name":"notlee","email":"lee@leemoody.co.uk"},{"name":"quarterto","email":"bren@153.io"},{"name":"robinmarr-ft","email":"robin.marr@ft.com"},{"name":"rowanmanning","email":"accounts@rowanmanning.co.uk"},{"name":"sdbernard","email":"steve.bernard@ft.com"},{"name":"tatiana.stantonian","email":"tatiana.stantonian@ft.com"},{"name":"the-ft","email":"strategic.products+npm@ft.com"}],"homepage":"https://github.com/Financial-Times/o-comment-utilities#readme","bugs":{"url":"https://github.com/Financial-Times/o-comment-utilities/issues"},"dist":{"shasum":"04a75c40484f759cbf17897f3fd2a24e3148cfeb","tarball":"https://registry.npmjs.org/@financial-times/o-comment-utilities/-/o-comment-utilities-2.4.2.tgz","fileCount":43,"integrity":"sha512-uTUTZUYuz8WGqx0RbvRg+77Hqup7m7LSI+EPYlaZx08D5YAcW19Qwr+ijor7GP7a5/3+fhX/Q97n6iUH6XbZjg==","signatures":[{"sig":"MEUCIADfFEdrFUmr8egZywSTLYYBrXwAtpCzr7rPQm9a67+/AiEA0eIo7dWqvLrOECuGuepIY5dFaGCuzBs88UwxJzwfcBQ=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":85235,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeey7sCRA9TVsSAnZWagAAKI0QAIteOFOFXx5d4rbdwG3P\nw0KtDWUBDcDH3T8X2ggoCb00absuF0znfS+Ak0aANljif2uxmbcIaBt8CuMd\nf4Q/YvI1dyjfEdjUAUo5GKFADGMDuMsqrIMtqP74ZeAlBxqwJzm7F60KW3K2\nWr21o4JO5/2j1/5+axXHs739C1HtgX9Lt1R+RByPQCibVUdY72c3KXXKgSxE\nkmRVGoBMR1sG92cf5Yuec1O8ORcvNtzus3LdbbnthPktja+DavJFvnM3xRu7\nC4lkeh3FVtsB69HMOUdxdeQzcPjXhqLZVDSvgrj8ag7WWlcia4hu8yaS90o3\nUpguDwXhTFpiLAgG3OqAZqGDyl51inroS57FJHBitvllE9+AUN7S0CpN1qLi\nXq1qFdiK/ggdgVxLpN03/GU5VWepWSxpMAkd1F499JPf933kgytdwDMCxLUY\nnVE82uxmHEB1dxfJPMxoT4euJq2NdMiDTnfIDb9MXWbhDAL/5qhH49SY0csT\n07EGM4/yjpGnvJiNQfZjwupEgD22WQK8ZVmkU5w4DxXhcuZoGDOF0KKvxAws\ns+MdlaJ/UUaMJIET+CiRHFLY3uSkOy+/9gc9qiuN1S2N062XssjAuLQzgg6r\n/oCmJZprCnoqwG6i+sFf84K/OjxQX3g6eTQmz7eI1Qriul//3Vse97gzTJsL\nIA/+\r\n=1E98\r\n-----END PGP SIGNATURE-----\r\n"},"browser":"browser.js","gitHead":"79025a6255df4f24a214f5b7a66be89417f06e44","scripts":{},"_npmUser":{"name":"the-ft","email":"strategic.products+npm@ft.com"},"component":"o-comment-utilities","repository":{"url":"git+ssh://git@github.com/Financial-Times/o-comment-utilities.git","type":"git"},"_npmVersion":"6.13.4","description":"A collection of helper functions used by o-comments and o-chat.","directories":{},"_nodeVersion":"10.19.0","dependencies":{},"eslintIgnore":["browser.js","dist/"],"_hasShrinkwrap":false,"devDependencies":{"origami-ci-tools":"^1.0.0","eslint-config-origami-component":"^2.0.1"},"_npmOperationalInternal":{"tmp":"tmp/o-comment-utilities_2.4.2_1585131244153_0.6212949879221634","host":"s3://npm-registry-packages"}},"2.4.3":{"name":"@financial-times/o-comment-utilities","version":"2.4.3","keywords":["origami","component","ft"],"_id":"@financial-times/o-comment-utilities@2.4.3","maintainers":[{"name":"aendrew","email":"aendrew@aendrew.com"},{"name":"axgy","email":"a@ax.gy"},{"name":"bobhaslett","email":"bob.haslett@ft.com"},{"name":"briggsc","email":"charlie.briggs@bbc.co.uk"},{"name":"chee","email":"chee@snoot.club"},{"name":"conor-mullen","email":"conor.mullen@ft.com"},{"name":"ft-internal-products","email":"ip.engineering@ft.com"},{"name":"i-like-robots","email":"matt+npm@maketea.co.uk"},{"name":"jakedchampion","email":"me@jakechampion.name"},{"name":"joannaskao","email":"joannaskao@gmail.com"},{"name":"mattandrews","email":"matt@mattandre.ws"},{"name":"notlee","email":"lee@leemoody.co.uk"},{"name":"quarterto","email":"bren@153.io"},{"name":"robinmarr-ft","email":"robin.marr@ft.com"},{"name":"rowanmanning","email":"accounts@rowanmanning.co.uk"},{"name":"sdbernard","email":"steve.bernard@ft.com"},{"name":"tatiana.stantonian","email":"tatiana.stantonian@ft.com"},{"name":"the-ft","email":"strategic.products+npm@ft.com"}],"homepage":"https://github.com/Financial-Times/o-comment-utilities#readme","bugs":{"url":"https://github.com/Financial-Times/o-comment-utilities/issues"},"dist":{"shasum":"ef4c6c1367222a30e4d20c619ee4a74891cb3604","tarball":"https://registry.npmjs.org/@financial-times/o-comment-utilities/-/o-comment-utilities-2.4.3.tgz","fileCount":43,"integrity":"sha512-tjqoKgLRo4aNxOeOB8LpcUFRtt6rwdyGa+/ldmP2nVrN+2F/f9+d1ruh6dZRPKQkGMtkPz+X+RHpFylYMG9qQg==","signatures":[{"sig":"MEUCIGPJUHx4Gas5NIvP3ARsN9cdzgMwnTTDS3uQYf5VX+o8AiEAiEhvl+qfBW1xm5ZTvR+pLqj4c3OZcCakvBPaFf8kDlc=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":85233,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh2HHeCRA9TVsSAnZWagAAgmsP+wSgrc9OojLDq1moGxqU\nVhiDTBRV4RtaWB92uNeDWAsJqRS0qBjLlyYYp6pLzRG8m3AYZyircmVHF4Cs\nLIgiOI2H9zcWbiYk8RgSFR9o7OhbuNMfZAvFfI2wArN9dorGX9ckW/NqLkdq\n/6MI5Lw4GFr+RsE86WCRnBW6iIxcRE0vgDyR7PsLvhvtfg5iDbzdvM55JbIJ\noBEAQKTLeNzkgKVuRSlgU/PPYSllTs1n2Me9W5y239S1bFIKPmZszNq58X3R\n0X0camzIAwpsnxGypBnxzLVALy2OnD2valSkfNWIYJJgmg/QmT9D2C1+rN4T\nQZoyNUp8/S1nxCgr/kzQeXhFZoELHVJj5WqCGMf+5CDROwh4eQHfcqgesiiq\nwoGGpPEGkoHJfG0FnPpIgAZASCdnsijEWubUc7tyKKItAsuvWOzgoqi9KQvf\nt2wrdCPLl3Z/v1FdM2QUQMx6U29ZHxPJHMMiy0llIfCFogcf11ZPXIuQOAX2\nuU2R7ODQ7M8ItiLQ+GKy/LsanVqX02kkebzSwphcOT32mNLEotsh2IoKIrCn\nED9HK9j2ZzAF1veU2uJomWv0u/M4Cwkq65CsOBM6G6Lg71Hep6aT121ljjEh\nFpDoPw58AwpyRtr6hF+88mf1Xg6MfwGrHkHR+x10Fzj//sOcyCadeMhdZAMX\nd84V\r\n=XAux\r\n-----END PGP SIGNATURE-----\r\n"},"browser":"browser.js","gitHead":"e16057bbf72ae97215625c1fd3b8fe02673e0d3e","scripts":{},"_npmUser":{"name":"the-ft","email":"strategic.products+npm@ft.com"},"component":"o-comment-utilities","repository":{"url":"git+ssh://git@github.com/Financial-Times/o-comment-utilities.git","type":"git"},"_npmVersion":"6.13.4","description":"A collection of helper functions used by o-comments and o-chat.","directories":{},"_nodeVersion":"10.19.0","dependencies":{},"eslintIgnore":["browser.js","dist/"],"_hasShrinkwrap":false,"devDependencies":{"origami-ci-tools":"^1.0.0","eslint-config-origami-component":"^2.0.1"},"_npmOperationalInternal":{"tmp":"tmp/o-comment-utilities_2.4.3_1585824631726_0.7451571435751796","host":"s3://npm-registry-packages"}}},"time":{"created":"2019-02-19T17:55:53.418Z","modified":"2026-06-23T16:03:16.886Z","2.4.0":"2019-02-19T17:55:53.726Z","2.4.1":"2020-03-24T11:38:18.076Z","2.4.2":"2020-03-25T10:14:04.247Z","2.4.3":"2020-04-02T10:50:31.852Z"},"bugs":{"url":"https://github.com/Financial-Times/o-comment-utilities/issues"},"homepage":"https://github.com/Financial-Times/o-comment-utilities#readme","keywords":["origami","component","ft"],"repository":{"url":"git+ssh://git@github.com/Financial-Times/o-comment-utilities.git","type":"git"},"description":"A collection of helper functions used by o-comments and o-chat.","maintainers":[{"email":"code.management@ft.com","name":"the-ft"},{"email":"info+npm@rowanmanning.com","name":"rowanmanning"},{"email":"yay@chee.party","name":"chee"},{"email":"a@ax.gy","name":"alexwilson"},{"email":"howdy@aendra.com","name":"aendra"},{"email":"emma.lewis@ft.com","name":"emmalewis"},{"email":"lee@leemoody.co.uk","name":"notlee"},{"email":"hamza.samih@ft.com","name":"hamza.samih"},{"email":"robert.boulton@ft.com","name":"robertboulton"},{"email":"leila.micollier@ft.com","name":"leila.micollier"},{"email":"rob.godfrey@ft.com","name":"robgodfrey"}],"readme":"# o-comment-utilities [![Build Status](https://travis-ci.org/Financial-Times/o-comment-utilities.svg?branch=master)](https://travis-ci.org/Financial-Times/o-comment-utilities)\n\nA collection of helper functions used by o-comments and o-chat.\n\n## Contents\n\n * <a href=\"#api\">API</a>\n     * <a href=\"#envConfig\">envConfig</a>\n     * <a href=\"#events\">Events</a>\n     * <a href=\"#envConfig\">envConfig</a>\n     * <a href=\"#jsonp\">jsonp</a>\n     * <a href=\"#scriptLoader\">scriptLoader</a>\n     * <a href=\"#storageWrapper\">storageWrapper</a>\n     * <a href=\"#logger\">logger</a>\n     * <a href=\"#functionSync\">functionSync</a>\n     * <a href=\"#domConstruct\">domConstruct</a>\n     * <a href=\"#cookie\">cookie</a>\n     * <a href=\"#ftUser\">ftUser</a>\n\n\n## <div id=\"api\"></div> API\n\n### <div id=\"envConfig\"></div> envConfig\nThis module provides a useful way to handle application level configurations. It supports setting and reading configurations, also overriding existing values (helpful when the application should be working on different environments with partially different configuration).\n\n#### Constructor\nIn order to create a configuration, you should create an instance first:\n\n```javascript\nvar config1 = new oCommentUtilities.EnvConfig();\n```\n\n\nIn order to keep an isolated configuration object of your application, which is accessible within your whole application, the following method can be used:\n\n - define a config.js file within your application\n - create an instance of config.js and expose it within the application:\n\n```javascript\nvar EnvConfig = require('js-env-config');\n\nmodule.exports = new EnvConfig();\n```\n\n#### Methods\n###### get\nGets the whole configuration if without parameter, or a field if a field is given as parameter.\n\nGetting the whole configuration object:\n\n```javascript\nconfig.get();\n```\n\n\nGetting a field of the configuration object:\n\n```javascript\nconfig.get('aField');\n```\n\n###### set\nSets the configuration. The current configuration is merged with this object. Existing fields that have primitive type values and the same field has value in the object given to set, are overwritten.\n\nSetting an object:\n\n```javascript\nconfig.set({\n    'configField': 'value'\n});\n```\n\n\nSetting a key/value:\n\n```javascript\nconfig.set('aField', {\n    'configField': 'value'\n});\n```\n\nThis is equivalent with the following object:\n\n```javascript\n{\n    \"aField\": {\n        \"configField\": \"value\"\n    }\n}\n```\n\n\n### <div id=\"events\"></div> Events\nThis module helps creating custom events, listening on custom events and triggering them. It is similar to jQuery's event system (except that it doesn't support namespacing).\n\n#### Constructor\nThe constructor has no parameter.\n\n```javascript\nvar myEvent = new Events();\n```\n\n#### Methods\n###### on\nRegisters a new event handler to an event.\n\n```javascript\nmyEvent.on(event, handler)\n```\n\nWhere:\n\n - event: name of the event\n - handler: function which is called when the event is triggered. The handler can receive parameters if the trigger was made with data to be forwarded to handlers.\n\n###### one\nRegisters a new event handler to an event. Similar to 'on', but the handler is called only once.\n\n```javascript\nmyEvent.one(event, handler)\n```\n\n###### off\nRemoves one or more event handlers.\n\n```javascript\nmyEvent.off(event, handler)\n```\n\nWhere:\n\n - event: name of the event from which the handler should be removed.\n - handler: handler function that will be removed.\n\nIf handler is omitted, all event handlers from the event specified are removed.\nIf both event and handler are omitted, all event handlers are removed.\n\n###### trigger\nTriggers an event: it causes calling all the event handlers that are listening for the event name.\n\n```javascript\nmyEvent.trigger(event, customData)\n```\n\nWhere:\n\n - event: name of the event for which the handlers should be called.\n - customData: optional parameter, data to be passed to the event handlers.\n\n\n### <div id=\"jsonp\"></div> jsonp\nThis module provides a similar solution for JSONP communication as jQuery. For more information on JSONP, visit https://www.w3schools.com/js/js_json_jsonp.asp .\n\nThe module is actually a single function. It should be called the following way:\n\n```\ncommentUtilitis.jsonp({\n    url: \"URL here\",\n    data: \"Data here\" //optional\n}, function (err, data) {\n    if (err) {\n        throw err;\n    }\n\n    // use the data\n});\n```\n\nBoth parameters (configuration object and callback) are required. Also, the configuration should contain the 'url' field.\n\n###### data\nIf data should be sent, it can be part of the URL directly, or can be provided as the data field within the configuration object. The data field should be an object with key-value pairs.\n\n###### callback\nThe callback has a Node.js inspired form. The first parameter is the error parameter, while the second one is the data parameter received from the server as a response.\n\n\n### <div id=\"scriptLoader\"></div> scriptLoader\nThis module provides a similar solution for loading a Javascript file asynchronously as jQuery's $.getScript() (http://api.jquery.com/jquery.getscript/).\n\nThe module is actually a single function. It can be called the following ways:\n\n1.\n\n```\noCommentUtilities.scriptLoader({\n    url: \"URL here\",\n    charset: \"utf-8\" //optional\n}, function (err) {\n    if (err) {\n        throw err;\n    }\n\n    // loaded successfully\n});\n```\n\n2.\n\n```\noCommentUtilities.scriptLoader(\"URL here\", function (err) {\n    if (err) {\n        throw err;\n    }\n\n    // loaded successfully\n});\n```\n\nBoth parameters (configuration object/URL and callback) are required. Also, if the configuration is an object, it should contain the 'url' field.\n\n###### callback\nThe callback has a Node.js inspired form. The parameter is either 'null' or an Error instance. If it doesn't contain an error, the loading finished with success.\n\n\n### <div id=\"storageWrapper\"></div> storageWrapper\nWrapper around localStorage and sessionStorage, but enhanced with automatic type conversion.\n\nAutomatic type conversion means the followin: for example, if you store an object which can be serialized into a JSON string, when you read it back you will get the same Javascript object and not just a plain string.\n\nThe module exposes two main fields, both having the same API:\n\n```javascript\noCommentUtilities.storageWrapper.localStorage //wrapper around native localStorage\noCommentUtilities.storageWrapper.sessionStorage //wrapper around native sessionStorage\n```\n\n#### API of localStorage and sessionStorage\nBoth submodules has the same public API. The difference is only the place the data is saved (as it is in the native API).\n\nAvailable methods:\n###### setItem\nSaves an item in the storage. It has the following form:\n\n```javascript\nsetItem(key, value);\n```\n\nThe value is saved in the storage with the key. The value can be looked up using the key provided.\n\n\nThe item is saved in the following format:\n\n```\n{type}|{value converted/serialized to string}\n```\n\nFor example, a boolean \"true\" value is saved in the following way:\n\n```\nboolean|true\n```\n\nObjects that can be serialized are saved with the type \"json\".\n\n###### getItem\nReads the item and returns it in the original type that was saved.\n\n```javascript\ngetItem(key);\n```\n\nFor example, if a boolean true was saved, it is not returned as a string, but as a boolean type.\n\n###### hasItem\nReturns true or false and it says if there is an item with that key.\n\n```javascript\nhasItem(key);\n```\n\n###### removeItem\nRemoves the item saved with the key provided.\n\n```javascript\nremoveItem(key);\n```\n\n###### clear\nClears all entries for the current domain.\n\n###### native\nReturns the native localStorage or sessionStorage object.\n\n\n\n### <div id=\"logger\"></div> logger\nLogging helper which uses the native \"console\" to log. It also extends IE8 logging capabilities by stringifying complex objects.\n\nWhere console is not available, the logger fails silently.\n\nThe module supports the following methods:\n\n#### Logger configuration\nThe logger can be configured with the following: enable/disable, set the minimum level that is logged.\n\nBy default is logging disabled (recommended settings for production).\nDefault level of logging is 'warn'.\n\n###### enable\nEnables the logging.\n\n```javascript\nlogger.enable();\n```\n\n###### disable\nDisables the logging.\n\n```javascript\nlogger.disable();\n```\n\n###### setLevel\nSets the minimum level that should be logged. The levels are the following:\n\n - debug\n - log\n - info\n - warn\n - error\n\n```javascript\nlogger.setLevel(level);\n```\n\nWhere level can be:\n - string: anything from the list above\n - numeric: any number from the range between 0-4, where 0 means log everything (min level is debug), while 4 means log only error level logs.\n\n#### Logging functions\nAvailable functions:\n\n - debug\n - log\n - info\n - warn\n - error\n\n\n### <div id=\"functionSync\"></div> functionSync\n#### Parallel\nThis submodule is meant to generate a callback only when all functions provided finished their execution. This is achieved by passing a callback as parameter to the functions that are executed.\n\nThe submodule itself is a single function and can be called in the following way:\n\n```javascript\noCommentUtilities.functionSync.parallel({\n    func1: function (callback) {},\n    func2: function (callback) {},\n    func3: {\n        args: ['param1', 'param2'],\n        func: function (callback, param1, param2) {}\n    }\n}, function (dataAggregate) {\n    // where data aggregate is:\n    // {\n    //      func1: 'dataFromFunc1',\n    //      func2: 'dataFromFunc2',\n    //      func2: 'dataFromFunc2'\n    // }\n}\n});\n```\n\nFunctions provided within the object can be in the following forms:\n\n1. Single function. As example are func1 and func2.\n2. Object with the following fields: func is the actual function that will be called, args are the arguments that are appended after the callback parameter.\n\n\n\n\nFor more information on the technical side, please visit the detailed documentation (docs/index.html).\n\n### <div id=\"domConstruct\"></div> domConstruct\nThis module is able to instantiate classes extended from o-comment-ui/Widget.js using markup in the DOM.\n\n#### How to use it\nThis feature reads the DOM for certain types of elements. An example element:\n\n```html\n<div data-o-component=\"o-chat\" id=\"commentWidget\" data-o-chat-config-title=\"o-chat-test-closed3\" data-o-chat-config-url=\"http://ftalphaville.ft.com/marketslive-test.html\" data-o-chat-config-articleId=\"marketslive-test\" data-o-chat-config-order=\"inverted\"></div>\n```\n\nKey parts of the DOM element:\n\n - `data-o-component`: defines the type of Widget element, in this example `o-chat`.\n - id: optional, if it's not present it will be generated\n - data attributes in the format `data-o-{modulename}-config-{key}`: configuration options that are passed to the Widget constructor. `{key}` has the following rule: `--` means new object level, `-` means camel case. Example: `data-o-comments-config-livefyre--data-format--absolute=\"value\"` is transformed to: ```{\"livefyre\": {\"dataFormat\": {\"absolute\": \"value\"}}}```.\n\nIn order to start the DOM construction, the `oCommentUtilities.initDomConstruct` function should be called with a configuration object, which has the following fields:\n\n - context: an HTML element or selector. In this element will be performed the search for elements which has `data-o-component=\"{modulename}\"`. If none is specified, it falls back to `document.body`.\n - classNamespace: type of the Widget element, in the example above it would be a string `'o-chat'`. It is used as class and also as part of the data attributes.\n - eventNamespace: according to the origami spec, all events generated should be namespaced with the module's name, without dashes, but with camel case. In the example above namespace would be a string `'oChat'`.\n - module: reference to the global scope of the module. In the example above this would be the object `oChat`.\n - auto: if set to true, only the widgets which don't have `data-{namespace}-auto-init=\"false\"` (e.g. data-o-chat-init=\"false\") will be considered. This is useful when there are two phases of initialization: one on `o.DOMContentLoaded` and one on demand (lazy load). On `o.DOMContentLoaded` there will be loaded only the widgets which don't have this attribute, while the others only on explicit call.\n\nExample: \n\n```javascript\nvar initDomConstructOnDemand = function () {\n    oCommentUtilities.initDomConstruct({\n        classNamespace: 'o-chat',\n        eventNamespace: 'oChat',\n        moduleRef: oChat,\n        classRef: oChat.Widget\n    });\n}\n\ndocument.addEventListener('o.DOMContentLoaded', function () {\n    oCommentUtilities.initDomConstruct({\n        classNamespace: 'o-chat',\n        eventNamespace: 'oChat',\n        moduleRef: oChat,\n        classRef: oChat.Widget,\n        auto: true\n    });\n});\n```\n\n\n\nIn some cases this module should be called on demand by the product, so it could be exposed as a public API as part of the module which uses it.\n\n\nExample: (from o-chat/main.js)\n\n```javascript\nvar Widget = require('./src/javascripts/Widget.js');\n\nexports.init = function (el) {\n    return oCommentUtilities.initDomConstruct({\n        context: el,\n        classNamespace: 'o-chat',\n        eventNamespace: 'oChat',\n        moduleRef: this,\n        classRef: Widget\n    });\n};\n```\n\nThis way all the configurations are abstracted, the product should not care about setting them.\n\nIf you want to obtain a reference of the created *Class* instances, you should listen on the body to the event `{namespace}.ready` (e.g. oChat.ready), which will have the following details:\n\n - id: ID of the widget, which is basically the ID attribute of the owned DOM element\n - instance: the instance of the *Class*\n\nExample:\n\n```javascript\ndocument.body.addEventListener('oChat.ready', function (evt) {\n    //evt.detail.id and evt.detail.instance are available\n});\n```\n\n\nThe instance that is already created will have a flag that says that it shouldn't be created again, even if initDomConstruct is called again. The flag that is set is `data-{namespace}-built=\"true\"` (e.g. data-o-chat-built=\"true\"). **If you are creating instances in another way (programatically), the container element should have this flag set.**\n\n#### Return value\nThe return value is an array with all the instances of `Class` (e.g. oChat.Widget) created.\n\n\n\n### <div id=\"cookie\"></div> cookie\nHelpers for working with cookies.\n\n#### get\nReads a cookie by name.\n\n```javascript\noCommentUtilities.cookie.get('name');\n```\n\n#### set\nSets a cookie.\n\n```javascript\noCommentUtilities.cookie.set('name', 'value', 36 /*days */);\n```\n\n#### remove\nRemoves a cookie\n\n```javascript\noCommentUtilities.cookie.remove('name');\n```\n\n\n### <div id=\"ftUser\"></div> ftUser\nftUser is a helper for obtaining information about the FT user, information like logged in status, user ID, email address, session ID.\n\nMethods exposed that can be used:\n - isLoggedIn: returns the user's login status: true or false.\n - getEmail: returns the user's email address\n - getUserId: returns the user's ID\n - getSession: returns the FT session ID\n\n","readmeFilename":"README.md"}