{"id":18738993,"url":"https://github.com/gaubee/aot","last_synced_at":"2025-08-05T16:10:42.932Z","repository":{"id":57181143,"uuid":"151651857","full_name":"Gaubee/AOT","owner":"Gaubee","description":"change you code Ahead-of-time","archived":false,"fork":false,"pushed_at":"2018-10-05T01:24:03.000Z","size":74,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-13T23:03:13.439Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Gaubee.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-10-05T00:19:59.000Z","updated_at":"2021-12-18T09:35:07.000Z","dependencies_parsed_at":"2022-09-14T03:31:53.659Z","dependency_job_id":null,"html_url":"https://github.com/Gaubee/AOT","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/Gaubee%2FAOT","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gaubee%2FAOT/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gaubee%2FAOT/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gaubee%2FAOT/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Gaubee","download_url":"https://codeload.github.com/Gaubee/AOT/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239616131,"owners_count":19668992,"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-11-07T15:32:22.340Z","updated_at":"2025-02-19T07:29:38.565Z","avatar_url":"https://github.com/Gaubee.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AOT\n\n## usage\n\n### Wait\nwait some condition before do something.\n\n```ts\nimport { AOT_Placeholder, AOT } from 'aot';\n\nclass DB_Base {\n    constructor(){\n        this._db_init = this.initConnect()\n    }\n    protected _db_init:Promise\u003cvoid\u003e\n    async initConnect(){\n        // connect database in async\n    }\n}\n\nclass MyDB extends DB_Base {\n    private _init_aot = new AOT(\"init my db\");\n    constructor(){\n        super();\n        // replace the placeholder, function now in JIT mode.\n        this._init_aot.autoRegister(this);\n\n        this._db_init.then(()=\u003e{\n            // complie the code Ahead-of-time\n            this._init_aot.compile(true);\n        });\n    }\n\n    @AOT_Placeholder.Wait(\"_db_init\") // the insert code would run after this._db_init resolved.\n    async insert(){\n        // do something\n    }\n}\n```\n\n### Then\nreplace some function if condition is false.\n\n```ts\nclass FileSystem_Shim {\n    private async _writeFile_idb(){\n        // write file from indexeddb \n    }\n}\n\nclass FileSystem extends FileSystem_Shim{\n    private _can_fs = new AOT('RequestFileSystem');\n    constructor(){\n        super();\n        this._can_fs.autoRegister(this);\n\n        this._can_fs.compile('webkitRequestFileSystem' in self||'requestFileSystem' in self);\n    }\n    @AOT_Placeholder.Then('_writeFile_idb')// if condition is false, use the 'Then' function\n    async writeFile(){\n        // write file by using fileSystem API\n    }\n}\n```\n\n\n\u003e you can use `Wait` before `Then`. have fun.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgaubee%2Faot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgaubee%2Faot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgaubee%2Faot/lists"}