{"id":21251532,"url":"https://github.com/foodee/flipper-rb-js","last_synced_at":"2025-07-11T01:32:13.301Z","repository":{"id":57142194,"uuid":"60215925","full_name":"Foodee/flipper-rb-js","owner":"Foodee","description":"Simple lib for letting JS talk to Flipper.rb","archived":false,"fork":false,"pushed_at":"2016-06-03T02:51:49.000Z","size":16,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-11-17T05:36:32.247Z","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/Foodee.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":"2016-06-01T22:49:27.000Z","updated_at":"2023-08-18T15:17:51.000Z","dependencies_parsed_at":"2022-09-05T18:51:14.342Z","dependency_job_id":null,"html_url":"https://github.com/Foodee/flipper-rb-js","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/Foodee%2Fflipper-rb-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Foodee%2Fflipper-rb-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Foodee%2Fflipper-rb-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Foodee%2Fflipper-rb-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Foodee","download_url":"https://codeload.github.com/Foodee/flipper-rb-js/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225669628,"owners_count":17505363,"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-21T03:42:32.529Z","updated_at":"2024-11-21T03:42:32.999Z","avatar_url":"https://github.com/Foodee.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# flipper-rb-js\n\n[![Build Status](https://travis-ci.org/Foodee/flipper-rb-js.svg)](https://travis-ci.org/Foodee/flipper-rb-js) [![Code Climate](https://codeclimate.com/github/Foodee/flipper-rb-js/badges/gpa.svg)](https://codeclimate.com/github/Foodee/flipper-rb-js) [![Issue Count](https://codeclimate.com/github/Foodee/flipper-rb-js/badges/issue_count.svg)](https://codeclimate.com/github/Foodee/flipper-rb-js) [![Test Coverage](https://codeclimate.com/github/Foodee/flipper-rb-js/badges/coverage.svg)](https://codeclimate.com/github/Foodee/flipper-rb-js/coverage)\n\n\nSimple lib for letting your JavaScript talk to Flipper.rb\n\n## Motivation\n\nIf you use the flipper library [https://github.com/jnunemaker/flipper](https://github.com/jnunemaker/flipper) for your rails app,\nbut you also run an SPA, you may also want those feature flags to be visible in the JavaScript side of things. This library\naims to make that easy for you.\n\n## Usage - Rails side\n\nYou'll need to build an endpoint that exposes your feature flags for a particular user, the implementation currently\nassumes a simple json object:\n\n```JavaScript\n{\n  feature: true,\n  false: false\n}\n```\n\n## Usage - JavaScript\n\nUse the static initializer, which is promise aware.\n\n```JavaScript\n\nimport Flipper from 'flipper-rb';\n\nlet eventuallyFlipper = Flipper.load('/api/users/features');\n\neventuallyFlipper\n  .then(flipper =\u003e {\n  \n    if(flipper.isEnabled('featureName')){\n      // do some things \n    }\n    else {\n      // do some other things \n    }\n  });\n```\n\nThe library assumes native promises, but if you want to be backwards compatible you can pass a promise class into the\nload function like so\n\n```JavaScript\n\nlet eventuallyFlipper = Flipper.load('/api/users/features', {PromiseClass: Ember.RSVP.Promise});\n\n```\n\nYou might need some custom authentication (since you're likely flipping per user) so you can pass along some headers as well.\n\n```JavaScript\nlet eventuallyFlipper = Flipper.load('/api/users/features', {\n                                                              PromiseClass: Ember.RSVP.Promise,\n                                                              headers: {\n                                                                Authentication: token=\"myToken\"\n                                                              }\n                                                            });\n```\n\n\nHappy Flipping !\n\n\n## Shout outs\n\nThanks to [https://github.com/jnunemaker](https://github.com/jnunemaker) for Flipper!\n  ","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffoodee%2Fflipper-rb-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffoodee%2Fflipper-rb-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffoodee%2Fflipper-rb-js/lists"}