{"id":29027310,"url":"https://github.com/cahnory/jquery.easyplug","last_synced_at":"2025-06-26T06:05:24.405Z","repository":{"id":6566615,"uuid":"7808530","full_name":"cahnory/jQuery.easyPlug","owner":"cahnory","description":"Simplify the creation of jQuery plugin","archived":false,"fork":false,"pushed_at":"2014-03-24T12:50:10.000Z","size":447,"stargazers_count":13,"open_issues_count":3,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-06-26T06:05:23.755Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cahnory.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-MIT","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-01-24T22:20:06.000Z","updated_at":"2023-10-11T12:55:38.000Z","dependencies_parsed_at":"2022-08-26T11:01:03.296Z","dependency_job_id":null,"html_url":"https://github.com/cahnory/jQuery.easyPlug","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/cahnory/jQuery.easyPlug","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cahnory%2FjQuery.easyPlug","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cahnory%2FjQuery.easyPlug/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cahnory%2FjQuery.easyPlug/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cahnory%2FjQuery.easyPlug/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cahnory","download_url":"https://codeload.github.com/cahnory/jQuery.easyPlug/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cahnory%2FjQuery.easyPlug/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262010868,"owners_count":23244414,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-06-26T06:05:23.664Z","updated_at":"2025-06-26T06:05:24.390Z","avatar_url":"https://github.com/cahnory.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# What is easyPlug?\n\nEasyPlug simplify jQuery plugin authoring.\n\nPlugin creation only requires a definition object described below. **All jQuery related stuff is done for you**.\n\nWhile it's quicker to edit it pushes conventions over all *easyPlugged* plugins.\n\n# How it works?\n\nTo create your plugin, all you have to do is passing to easyPlug a **definition object** like this one:\n\n```\n// Return your plugin class\nPlugin = $.easyPlug({\n  name:      'example',\n  construct: function () {}\n});\n```\n\n## Definition object\n\nDefinition object does not require any member.\n\n### construct *\u003csmall\u003e(function)\u003c/small\u003e*\n\nA function called each time the plugin is instanciate for an element.\n\n### events *\u003csmall\u003e(array)\u003c/small\u003e*\n\nA list of custom events. Each event name will be prefixed and added to the events member of the Plugin:\n\n```\n$.easyPlug({\n  name:   'example'\n  events: ['foo']\n});\n\n// 'easyPlug__example-foo'\n$.example.events.foo;\n```\n\n### init *\u003csmall\u003e(function)\u003c/small\u003e*\n\nA function called when instanciating the Plugin for the first time.\n\n### invoke *\u003csmall\u003e(function)\u003c/small\u003e*\n\nA function called when invoking inaccessible methods:\n\n```\n$.easyPlug({\n  invoke: function (name, args) {}\n});\n```\n\n### name *\u003csmall\u003e(string)\u003c/small\u003e*\n\nThe name of your plugin.\n\n```\n$.easyPlug({name: 'example'});\n\n// Plugin class\n$.example;\n\n// Plugin instance\n$('.some-elements').example();\n```\n\n### presets *\u003csmall\u003e(object)\u003c/small\u003e*\n\nProperties used by the plugin. Each plugin instance get an object combining presets and options passed by the user on instanciation:\n\n```\n// $.extend({}, presets, options)\nthis.settings;\n```\n\n### prototype *\u003csmall\u003e(object)\u003c/small\u003e*\n\nThe prototype of your Plugin. Each method of the prototype could be called like thid:\n\n```\n$('.some-elements').example('methodName', arg1, arg2);\n```\n\n\n## Plugin methods\n\nEasyPlug defines \"static\" methods to each Plugin it generates.\n\n### addPrefix(stringToPrefix)\n\nAdd a prefix uniq to the Plugin to any word in the string. It's this function which prefixes custom events.\n\n```\n// 'easyPlug__example-foo easyPlug__example-bar'\n$.example.addPrefix('foo bar');\n```\n\n### addNamespace(stringToNamespace[, local])\n\nAdd a namespace uniq to the Plugin to any word in the string. Use this when binding, setting/getting data,… in your plugin.\n\n```\n// 'foo.easyPlug__example bar.easyPlug__example'\n$.example.addNamespace('foo bar');\n\n// 'foo.easyPlug__example.myNS bar.easyPlug__example.myNS'\n$.inlineput.addNamespace('foo bar', 'myNS');\n```\n\n### getName()\n\nReturn the name of the plugin.\n\n```\n// 'example'\n$.example.getName();\n```\n\n## easyPlug methods\n\n### isPluggedTo(element, plugin)\n\nTell if the element was plugged by a particular plugin:\n\n```\n// false\n$.easyPlug.isPluggedTo($('#single-element'), 'example');\n\n// Here, element could be in a larger collection\n$('#single-element').example();\n\n// true\n$.easyPlug.isPluggedTo($('#single-element'), 'example');\n```\n\n### getInstance(element, plugin)\n\nReturn the plugin instance of an element if exists:\n\n```\n// undefined\n$.easyPlug.getInstance($('#single-element'), 'example');\n\n// Here, element could be in a larger collection\n$('#single-element').example();\n\n// Return the plugin instance\n$.easyPlug.getInstance($('#single-element'), 'example');\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcahnory%2Fjquery.easyplug","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcahnory%2Fjquery.easyplug","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcahnory%2Fjquery.easyplug/lists"}