{"id":22433844,"url":"https://github.com/gavinning/aimee-class","last_synced_at":"2025-03-27T07:46:21.329Z","repository":{"id":34434802,"uuid":"38368225","full_name":"gavinning/aimee-class","owner":"gavinning","description":"Aimee的基类模块，用于创建类","archived":false,"fork":false,"pushed_at":"2015-10-10T02:32:50.000Z","size":148,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-01T12:46:45.549Z","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":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gavinning.png","metadata":{"files":{"readme":"README.MD","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-07-01T11:45:38.000Z","updated_at":"2015-07-01T11:46:54.000Z","dependencies_parsed_at":"2022-09-14T06:11:17.783Z","dependency_job_id":null,"html_url":"https://github.com/gavinning/aimee-class","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gavinning%2Faimee-class","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gavinning%2Faimee-class/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gavinning%2Faimee-class/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gavinning%2Faimee-class/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gavinning","download_url":"https://codeload.github.com/gavinning/aimee-class/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245806392,"owners_count":20675296,"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":"2024-12-05T22:16:02.886Z","updated_at":"2025-03-27T07:46:21.308Z","avatar_url":"https://github.com/gavinning.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Aimee-class\n\nAimee-class Aimee的基类模块，用于创建类，依赖aimee-extend, aimee-is  \nAimee-class是基于UZ构建工具定制化的模块所以最好配合UZ使用  \nAimee-class是一个类CMD规范的模块，包装上define部分就可以配合seajs使用了\n\n[Aimee-is](https://github.com/gavinning/aimee-is)  \n[Aimee-extend](https://github.com/gavinning/aimee-extend)\n\n\n##Install  \n```\nnpm install aimee-class --save\n```\n\n##API\n```\nvar Class = require('class');\n\n\n// 创建子类\nvar Persion = Class.create();\n\n// 扩展类\nPerson.extend({foo: bar})\n\n// 扩展原型链\nPerson.include({foo: bar})\n\n// 扩展原型链\nPerson.fn.extend({foo: bar})\n\n// 创建实例\nvar person = new Person;\n```\n\n\n##Example\n\n\n```\n// 调用\nvar Class = require('class');\n```\n\n```\n// 创建一个纯净的类\nvar Person = Class.create({\n    hello: function(name){\n        console.log('Hello, My name is ' + name)\n    }\n});\n\nvar person = new Person;\n\nperson.hello('xiaoming')\n// =\u003e Hello, My name is xiaoming\n```\n\n```\n// 基于Person创建子类\nvar Man = Person.create({\n    strong: function(){\n        console.log('他是一个强壮的男人')\n    }\n});\n\nvar man = new Man;\n\nman.strong()\n// =\u003e 他是一个强壮的男人\n\nconsole.log(man.charm)\n// =\u003e undefined\n```\n\n```\n// 基于Person创建子类\nvar Woman = Person.create({\n    charm: function(){\n        console.log('她是一个美丽的女人')\n    }\n});\n\nvar woman = new Woman;\n\nwoman.charm()\n// =\u003e 她是一个美丽的女人\n\nconsole.log(woman.strong)\n// =\u003e undefined\n```\n\n```\n// 类可以根据需要无限扩展，无限继承，比如你还可以这样继续基于Woman创建子类\nvar Girl = Woman.create();\nGirl.fn.extend({\n    say: function(){\n        console.log('她是一个女孩')\n    }\n})\n\nvar girl = new Girl;\n\ngirl.charm()\n// =\u003e 她是一个美丽的女人\n\ngirl.say()\n// =\u003e 她是一个女孩\n\nconsole.log(girl.strong)\n// =\u003e undefined\n\nconsole.log(woman.say)\n// =\u003e undefined\n\nconsole.log(man.say)\n// =\u003e undefined\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgavinning%2Faimee-class","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgavinning%2Faimee-class","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgavinning%2Faimee-class/lists"}