{"id":16123465,"url":"https://github.com/jlchntoz/rotf","last_synced_at":"2026-05-13T20:35:01.479Z","repository":{"id":57354324,"uuid":"99708170","full_name":"JLChnToZ/rotf","owner":"JLChnToZ","description":"Require on-the-fly: A module adds ability to hot-reloading and lazy-loading on other modules","archived":false,"fork":false,"pushed_at":"2017-08-08T15:31:02.000Z","size":13,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-30T00:32:05.242Z","etag":null,"topics":["hot-reload","javascript","lazy-loading","nodejs"],"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/JLChnToZ.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":"2017-08-08T15:30:29.000Z","updated_at":"2020-07-30T09:31:27.000Z","dependencies_parsed_at":"2022-09-12T04:01:41.196Z","dependency_job_id":null,"html_url":"https://github.com/JLChnToZ/rotf","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/JLChnToZ%2Frotf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JLChnToZ%2Frotf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JLChnToZ%2Frotf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JLChnToZ%2Frotf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JLChnToZ","download_url":"https://codeload.github.com/JLChnToZ/rotf/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247478329,"owners_count":20945267,"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":["hot-reload","javascript","lazy-loading","nodejs"],"created_at":"2024-10-09T21:16:47.045Z","updated_at":"2025-10-28T15:47:09.157Z","avatar_url":"https://github.com/JLChnToZ.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"Require-OTF\n===========\n\nRequire-OTF (Require on-the-fly) - A Node.js module brings ability to hot-reloading and lazy-loading on other modules. Written in new ES6 flavor.\n\nUsage\n-----\n\nYou can just use the requireOTF as normal `require()` like this:\n```javascript\nconst requireOTF = require('require-otf').requireOTF(require);\nconst whatever = requireOTF('./path/to/module');\n\n// ...\n```\n\nWhen you edit and save the module file that required like above, it will auto reloaded, unless it is a native module.\n\nAdditional you may pass an object with these optional parameters at the second argument to control the behaviour:\n- `method`: string, must be `'native'` or `'polling'`, default is `'native'`, defines what method to determine the changes of JSON file. `'native'` mode will use system API to detect, and `'polling'` mode will poll the modefied time of the JSON file. In the most case 'native' is more efficient, but some of the operating system does not support this, in this case `'polling'` should be used as fallback.\n- `deferred`: boolean, set it to `true` to not start loading the module until the first access on its properties, default is `false`.\n- `resume`: boolean, resume tracking if there are any slept file change tracker on the module required, default is `false`.\n- `forceReload`: boolean, force to reload the module even it is already loaded, default is `false`.\n- `interval`: integer, the checking interval if `'polling'` mode is used. Default is `5000` milliseconds.\n- `reloadDelay`: integer, the delay between the file change notification received and reloading the module, default is `100` milliseconds.\n\nBesides the functions and properties provided in native `require()` from Node, Require-OTF also provided these functions in the instances, you may use `requireOTF.xxx` to use them:\n- `stopTrackAll()`: Stop all module file change trackers.\n- `stopTrack(module)`: Stop file change tracker belongs to the module path provided.\n  - `module`: string, the path to the module in current scope.\n- `resumeTrack(module, forceReload)`: Resume/restart file change tracker belongs to the module path provided.\n  - `module`: string, the path to the module in current scope.\n  - `forceReload`: boolean, `true` to force reload the module whatever it has been modified.\n- `unload(module)`: Unloads a module from cache, stops its file change tracker if available. All references to this module through Require-OTF will be invalid.\n  - `module`: string, the path to the module in current scope.\n- `enabled`: boolean, set to `false` to bypass everything, except for required modules, it is a global property and changing it will affect all Require-OTF instances in your application, default is `true`.\n\nInstall\n-------\n\nWith NPM:\n```sh\n$ npm i --save require-otf\n```\n\nLicense\n-------\n[MIT](LICENSE)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjlchntoz%2Frotf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjlchntoz%2Frotf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjlchntoz%2Frotf/lists"}