{"id":31829578,"url":"https://github.com/jwillinghalpern/fm-gofer","last_synced_at":"2025-10-11T20:51:07.532Z","repository":{"id":44890828,"uuid":"351341164","full_name":"jwillinghalpern/fm-gofer","owner":"jwillinghalpern","description":"An easy fetch-like promise library for FileMaker WebViewer apps and widgets.","archived":false,"fork":false,"pushed_at":"2024-11-21T15:05:01.000Z","size":1115,"stargazers_count":23,"open_issues_count":9,"forks_count":2,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-09-05T18:35:38.393Z","etag":null,"topics":["browser","filemaker","filemaker-scripts","filemaker-webviewer-apps","javascript","javascript-library","webviewer"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jwillinghalpern.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-03-25T07:09:24.000Z","updated_at":"2025-07-11T14:38:07.000Z","dependencies_parsed_at":"2022-08-01T01:48:54.390Z","dependency_job_id":"97d77c99-bb87-482c-9e0b-e793e921eccc","html_url":"https://github.com/jwillinghalpern/fm-gofer","commit_stats":{"total_commits":131,"total_committers":1,"mean_commits":131.0,"dds":0.0,"last_synced_commit":"7894326b2f83e0bccef01e71b45d9d26234df216"},"previous_names":[],"tags_count":27,"template":false,"template_full_name":null,"purl":"pkg:github/jwillinghalpern/fm-gofer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jwillinghalpern%2Ffm-gofer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jwillinghalpern%2Ffm-gofer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jwillinghalpern%2Ffm-gofer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jwillinghalpern%2Ffm-gofer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jwillinghalpern","download_url":"https://codeload.github.com/jwillinghalpern/fm-gofer/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jwillinghalpern%2Ffm-gofer/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279008637,"owners_count":26084480,"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","status":"online","status_checked_at":"2025-10-11T02:00:06.511Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["browser","filemaker","filemaker-scripts","filemaker-webviewer-apps","javascript","javascript-library","webviewer"],"created_at":"2025-10-11T20:51:06.681Z","updated_at":"2025-10-11T20:51:07.525Z","avatar_url":"https://github.com/jwillinghalpern.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# fm-gofer\n\nPromises in FM Web Viewers!\n\n![FM Gofer](./readme-files/fm-gofer.png)\n\nIt's like fetch() for FileMaker! Go'fer some data. Call FileMaker scripts from JavaScript in a web viewer and get the response back using async/await.\n\n## Try it\n\nCheck out `./example/FMGofer.fmp12`. This example demostrates the callback, resolve, reject, and timeout capabilities of the library. You can rebuild the example code used in the fm file by running `npm run build \u0026\u0026 npm run build:example`. This will output an html file in example/dist/index.html, which can be used in a FM webviewer.\n\n## Install fm-gofer in your JS project\n\n```bash\nnpm install --save fm-gofer\n```\n\n## Usage\n\n### Import fm-gofer\n\n#### `import` syntax\n\n```javascript\nimport FMGofer, { Option } from 'fm-gofer';\n```\n\n#### `require` syntax\n\n```javascript\nconst FMGofer = require('fm-gofer');\nconst { Option } = FMGofer;\n```\n\n#### Via CDN for convenience\n\n```html\n\u003c!-- This will set a global window property FMGofer --\u003e\n\u003cscript src=\"https://unpkg.com/fm-gofer/dist/fm-gofer.umd.cjs\"\u003e\u003c/script\u003e\n```\n\n#### Or copy into yout HTML if you really want\n\n```html\n\u003cscript\u003e\n  // This will set a global window property FMGofer\n  (copy of ./dist/fm-gofer.umd.cjs)\n\u003c/script\u003e\n```\n\n### Use fm-gofer\n\n#### In your JS\n\n```javascript\nimport FMGofer, { Option } from 'fm-gofer';\n\nconst a = await FMGofer.PerformScript('FM Script', param);\n// use the Option enum to specify the script option in human-readable form:\nconst b = await FMGofer.PerformScriptWithOption(\n  'FM Script',\n  param,\n  Option.SuspendAndResume\n);\n\n// Set a custom timeout/timeout message if the default to wait indefinitely is too long\nimport FMGofer, { Option } from 'fm-gofer';\n\nconst c = await FMGofer.PerformScript('FM Script', param, 5000, 'timed out!');\nconst d = await FMGofer.PerformScriptWithOption(\n  'FM Script',\n  param,\n  Option.SuspendAndResume,\n  5000,\n  'timed out!'\n);\n\n// Or if you file returns JSON, you can use the json() method to parse the result\nconst parsedData = await FMGofer.PerformScript('FM Script').json();\n```\n\n#### In your FileMaker script\n\nTo return data to JS, extract `callbackName` and `promiseID` from `Get ( ScriptParameter )`, and use it to call back to JS and resolve/reject the promise. Pass `True` as the last param (\"failed\") to reject the promise.\n\n```bash\nSet Variable [ $callbackName ; JSONGetElement ( Get(ScriptParameter) ; \"callbackName\" ) ]\nSet Variable [ $promiseID ; JSONGetElement ( Get(ScriptParameter) ; \"promiseID\" ) ]\n# this contains param data sent from JS\nSet Variable [ $parameter ; JSONGetElement ( Get(ScriptParameter) ; \"parameter\" ) ]\n\n# callback to JS like this:\n# (leave the third parameter slot empty or False to indicate a success. Or set to True to indicate an error)\nPerform JavaScript in Web Viewer [ Object Name: \"myWebview\" ; Function Name: $callbackName ; Parameters: $promiseID, 'Success! Hello from FM!' ]\n```\n\n#### TypeScript support\n\n```typescript\n// You can assert the shape of the result returned from FM using typescript!\ninterface MyResult {\n  name: string;\n  age: number;\n}\nconst j = await FMGofer.PerformScript('FM Script', param).json\u003cMyResult\u003e();\n// Nested properties auto-complete in VSCode now!\nconst name = j.name;\nconst age = j.age;\n```\n\n## MISC\n\n### Test\n\n```bash\nnpm test\n```\n\n### Build\n\n```bash\nnpm run build\n```\n\n## Contribute\n\nIf you see anything that should be improved please feel free to let me know or send pull requests.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjwillinghalpern%2Ffm-gofer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjwillinghalpern%2Ffm-gofer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjwillinghalpern%2Ffm-gofer/lists"}