@featurevisor/roku
Advanced tools
+1
-1
| { | ||
| "name": "@featurevisor/roku", | ||
| "version": "1.0.4", | ||
| "version": "1.0.5", | ||
| "description": "Roku FeatureVisor SDK", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
+162
-89
@@ -0,7 +1,60 @@ | ||
| [](https://featurevisor.com) | ||
| <div align="center"> | ||
| <h3><strong>Feature management for developers</strong></h3> | ||
| </div> | ||
| <div align="center"> | ||
| <small>Manage your feature flags and experiments declaratively from the comfort of your Git workflow.</small> | ||
| </div> | ||
| <br /> | ||
| <div align="center"> | ||
| <!-- NPM version --> | ||
| <a href="https://npmjs.org/package/@featurevisor/roku"> | ||
| <img src="https://img.shields.io/npm/v/@featurevisor/roku.svg" | ||
| alt="NPM version" /> | ||
| </a> | ||
| <!-- License --> | ||
| <a href="./LICENSE"> | ||
| <img src="https://img.shields.io/npm/l/@featurevisor/sdk.svg?style=flat-square" | ||
| alt="License" /> | ||
| </a> | ||
| </div> | ||
| <div align="center"> | ||
| <h3> | ||
| <a href="https://featurevisor.com"> | ||
| Website | ||
| </a> | ||
| <span> | </span> | ||
| <a href="https://featurevisor.com/docs/sdks/roku"> | ||
| Documentation | ||
| </a> | ||
| <span> | </span> | ||
| <a href="https://github.com/featurevisor/featurevisor-roku/issues"> | ||
| Issues | ||
| </a> | ||
| <span> | </span> | ||
| <a href="https://featurevisor.com/docs/contributing"> | ||
| Contributing | ||
| </a> | ||
| <span> | </span> | ||
| <a href="https://github.com/featurevisor/featurevisor-roku/blob/main/CHANGELOG.md"> | ||
| Changelog | ||
| </a> | ||
| </h3> | ||
| </div> | ||
| --- | ||
| # @featurevisor/roku <!-- omit in toc --> | ||
| BrightScript SDK for Roku. | ||
| BrightScript SDK for Roku is meant to be used with [kopytko-framework](https://github.com/getndazn/kopytko-framework). | ||
| Visit [https://featurevisor.com/docs/sdks/](https://featurevisor.com/docs/sdks/) for more information. | ||
| However, if you don't use it, you can simply copy all SDK files and their dependencies to your project (a version will be prepared in the future if anyone is interested). | ||
| Visit [https://featurevisor.com/docs/sdks/roku](https://featurevisor.com/docs/sdks/roku) for more information. | ||
| - [Installation](#installation) | ||
@@ -25,18 +78,18 @@ - [Usage](#usage) | ||
| - [API](#api) | ||
| - [`featurevisorSDK.onActivation`](#featurevisorsdkonactivation) | ||
| - [`featurevisorSDK.onReady`](#featurevisorsdkonready) | ||
| - [`featurevisorSDK.onRefresh`](#featurevisorsdkonrefresh) | ||
| - [`featurevisorSDK.onUpdate`](#featurevisorsdkonupdate) | ||
| - [`featurevisorSDK.isEnabled`](#featurevisorsdkisenabled) | ||
| - [`featurevisorSDK.getVariation`](#featurevisorsdkgetvariation) | ||
| - [`featurevisorSDK.getVariable`](#featurevisorsdkgetvariable) | ||
| - [`featurevisorSDK.activate`](#featurevisorsdkactivate) | ||
| - [`featurevisorSDK.clear`](#featurevisorsdkclear) | ||
| - [`featurevisorSDK.getRevision`](#featurevisorsdkgetrevision) | ||
| - [`featurevisorSDK.isReady`](#featurevisorsdkisready) | ||
| - [`featurevisorSDK.refresh`](#featurevisorsdkrefresh) | ||
| - [`featurevisorSDK.setDatafile`](#featurevisorsdksetdatafile) | ||
| - [`featurevisorSDK.setStickyFeatures`](#featurevisorsdksetstickyfeatures) | ||
| - [`featurevisorSDK.startRefreshing`](#featurevisorsdkstartrefreshing) | ||
| - [`featurevisorSDK.stopRefreshing`](#featurevisorsdkstoprefreshing) | ||
| - [`f.isEnabled`](#fisenabled) | ||
| - [`f.getVariation`](#fgetvariation) | ||
| - [`f.getVariable`](#fgetvariable) | ||
| - [`f.activate`](#factivate) | ||
| - [`f.onActivation`](#fonactivation) | ||
| - [`f.onReady`](#fonready) | ||
| - [`f.onRefresh`](#fonrefresh) | ||
| - [`f.onUpdate`](#fonupdate) | ||
| - [`f.clear`](#fclear) | ||
| - [`f.getRevision`](#fgetrevision) | ||
| - [`f.isReady`](#fisready) | ||
| - [`f.refresh`](#frefresh) | ||
| - [`f.setDatafile`](#fsetdatafile) | ||
| - [`f.setStickyFeatures`](#fsetstickyfeatures) | ||
| - [`f.startRefreshing`](#fstartrefreshing) | ||
| - [`f.stopRefreshing`](#fstoprefreshing) | ||
@@ -58,4 +111,4 @@ ## Installation | ||
| sub init() | ||
| m.featurevisorSDK = FeaturevisorSDK() | ||
| f = m.featurevisorSDK.createInstance({ | ||
| f = FeaturevisorSDK() | ||
| f.createInstance({ | ||
| datafileUrl: "<featurevisor-datafile-url>", | ||
@@ -72,4 +125,4 @@ }) | ||
| sub init() | ||
| m.featurevisorSDK = FeaturevisorSDK() | ||
| f = m.featurevisorSDK.createInstance({ | ||
| f = FeaturevisorSDK() | ||
| f.createInstance({ | ||
| ' options from an existing instance are kept but could be overridden | ||
@@ -109,4 +162,4 @@ }, existingInstance) | ||
| sub init() | ||
| m.featurevisorSDK = FeaturevisorSDK() | ||
| f = m.featurevisorSDK.createInstance({ | ||
| f = FeaturevisorSDK() | ||
| f.createInstance({ | ||
| configureBucketKey: function (feature as Dynamic, context as Object, bucketKey as String) as String | ||
@@ -130,4 +183,4 @@ return bucketKey | ||
| sub init() | ||
| m.featurevisorSDK = FeaturevisorSDK() | ||
| f = m.featurevisorSDK.createInstance({ | ||
| f = FeaturevisorSDK() | ||
| f.createInstance({ | ||
| configureBucketValue: function (feature as Dynamic, context as Object, bucketValue as String) as Integer | ||
@@ -165,4 +218,4 @@ return bucketValue ' 0 to 100000 | ||
| sub init() | ||
| m.featurevisorSDK = FeaturevisorSDK() | ||
| f = m.featurevisorSDK.createInstance({ | ||
| f = FeaturevisorSDK() | ||
| f.createInstance({ | ||
| initialFeatures: { | ||
@@ -200,4 +253,4 @@ myFeatureKey: { | ||
| } | ||
| m.featurevisorSDK = FeaturevisorSDK() | ||
| f = m.featurevisorSDK.createInstance({ | ||
| f = FeaturevisorSDK() | ||
| f.createInstance({ | ||
| configureAndInterceptStaticContext: defaultContext, | ||
@@ -227,4 +280,4 @@ interceptContext: function (context as Object) as Object | ||
| sub init() | ||
| m.featurevisorSDK = FeaturevisorSDK() | ||
| f = m.featurevisorSDK.createInstance({ | ||
| f = FeaturevisorSDK() | ||
| f.createInstance({ | ||
| onActivation: { | ||
@@ -261,4 +314,4 @@ callback: sub (data as Object) | ||
| sub init() | ||
| m.featurevisorSDK = FeaturevisorSDK() | ||
| f = m.featurevisorSDK.createInstance({ | ||
| f = FeaturevisorSDK() | ||
| f.createInstance({ | ||
| onReady: { | ||
@@ -288,4 +341,4 @@ callback: sub () | ||
| sub init() | ||
| m.featurevisorSDK = FeaturevisorSDK() | ||
| f = m.featurevisorSDK.createInstance({ | ||
| f = FeaturevisorSDK() | ||
| f.createInstance({ | ||
| onRefresh: { | ||
@@ -315,4 +368,4 @@ callback: sub () | ||
| sub init() | ||
| m.featurevisorSDK = FeaturevisorSDK() | ||
| f = m.featurevisorSDK.createInstance({ | ||
| f = FeaturevisorSDK() | ||
| f.createInstance({ | ||
| onUpdate: { | ||
@@ -339,4 +392,4 @@ callback: sub () | ||
| sub init() | ||
| m.featurevisorSDK = FeaturevisorSDK() | ||
| f = m.featurevisorSDK.createInstance({ | ||
| f = FeaturevisorSDK() | ||
| f.createInstance({ | ||
| datafileUrl: "<featurevisor-datafile-url>", | ||
@@ -361,4 +414,4 @@ refreshInterval: 60 * 5, ' every 5 minutes | ||
| sub init() | ||
| m.featurevisorSDK = FeaturevisorSDK() | ||
| f = m.featurevisorSDK.createInstance({ | ||
| f = FeaturevisorSDK() | ||
| f.createInstance({ | ||
| stickyFeatures: { | ||
@@ -381,94 +434,114 @@ myFeatureKey: { | ||
| Other methods that could be called before initialization: | ||
| ### `f.isEnabled` | ||
| ### `featurevisorSDK.onActivation` | ||
| Check if a feature is enabled or not. | ||
| > `featurevisorSDK.onActivation(func as Function, context = Invalid as Object)` | ||
| > `f.isEnabled(featureKey as String, context = {} as Object) as Boolean` | ||
| ### `featurevisorSDK.onReady` | ||
| ### `f.getVariation` | ||
| > `featurevisorSDK.onReady(func as Function, context = Invalid as Object)` | ||
| Get feature variation. | ||
| ### `featurevisorSDK.onRefresh` | ||
| > `f.getVariation(feature as Dynamic, context = {} as Object) as Dynamic` | ||
| > `featurevisorSDK.onRefresh(func as Function, context = Invalid as Object)` | ||
| ### `f.getVariable` | ||
| ### `featurevisorSDK.onUpdate` | ||
| Get feature variable. | ||
| > `featurevisorSDK.onUpdate(func as Function, context = Invalid as Object)` | ||
| > `f.getVariable(feature as Dynamic, variableKey as String, context = {} as Object) as Dynamic` | ||
| These methods should be called once the SDK instance is created: | ||
| Also supports additional type specific methods, returns the value of the desired type, or Invalid if the value does not exist or it does not have a desired type: | ||
| ### `featurevisorSDK.isEnabled` | ||
| - `f.getVariableBoolean(feature as Dynamic, variableKey as String, context = {} as Object) as Dynamic` | ||
| - `f.getVariableString(feature as Dynamic, variableKey as String, context = {} as Object) as Dynamic` | ||
| - `f.getVariableInteger(feature as Dynamic, variableKey as String, context = {} as Object) as Dynamic` | ||
| - `f.getVariableDouble(feature as Dynamic, variableKey as String, context = {} as Object) as Dynamic` | ||
| - `f.getVariableArray(feature as Dynamic, variableKey as String, context = {} as Object) as Dynamic` | ||
| - `f.getVariableObject(feature as Dynamic, variableKey as String, context = {} as Object) as Dynamic` | ||
| - `f.getVariableJSON(feature as Dynamic, variableKey as String, context = {} as Object) as Dynamic` | ||
| > `featurevisorSDK.isEnabled(featureKey as String, context = {} as Object) as Boolean` | ||
| ### `f.activate` | ||
| ### `featurevisorSDK.getVariation` | ||
| Same as `getVariation`, but also calls the `onActivation` callback. | ||
| > `featurevisorSDK.getVariation(feature as Dynamic, context = {} as Object) as Dynamic` | ||
| This is a convenience method meant to be called when you know the User has been exposed to your Feature, and you also want to track the activation. | ||
| ### `featurevisorSDK.getVariable` | ||
| > `f.activate(feature as Dynamic, context = {} as Object) as Object` | ||
| > `featurevisorSDK.getVariable(feature as Dynamic, variableKey as String, context = {} as Object) as Object` | ||
| ### `f.onActivation` | ||
| Also supports additional type specific methods: | ||
| Adds on activation callback which will be called after an feature activation. | ||
| - `featurevisorSDK.getVariableBoolean(feature as Dynamic, variableKey as String, context = {} as Object) as Boolean` | ||
| - `featurevisorSDK.getVariableString(feature as Dynamic, variableKey as String, context = {} as Object) as Dynamic` | ||
| - `featurevisorSDK.getVariableInteger(feature as Dynamic, variableKey as String, context = {} as Object) as Integer` | ||
| - `featurevisorSDK.getVariableDouble(feature as Dynamic, variableKey as String, context = {} as Object) as Float` | ||
| - `featurevisorSDK.getVariableArray(feature as Dynamic, variableKey as String, context = {} as Object) as Object` | ||
| - `featurevisorSDK.getVariableObject(feature as Dynamic, variableKey as String, context = {} as Object) as Object` | ||
| - `featurevisorSDK.getVariableJSON(feature as Dynamic, variableKey as String, context = {} as Object) as Dynamic` | ||
| > `f.onActivation(func as Function, context = Invalid as Object)` | ||
| ### `featurevisorSDK.activate` | ||
| ### `f.onReady` | ||
| > `featurevisorSDK.activate(feature as Dynamic, context = {} as Object) as Object` | ||
| Adds on ready callback which will be called after an instance is ready (datafile is saved). | ||
| Same as `getVariation`, but also calls the `onActivation` callback. | ||
| **It should be called before `createInstance`** | ||
| This is a convenience method meant to be called when you know the User has been exposed to your Feature, and you also want to track the activation. | ||
| > `f.onReady(func as Function, context = Invalid as Object)` | ||
| ### `featurevisorSDK.clear` | ||
| ### `f.onRefresh` | ||
| > `featurevisorSDK.clear()` | ||
| Adds on refresh callback which will be called after a successful datafile refresh. But the file doesn't need to change. | ||
| ### `featurevisorSDK.getRevision` | ||
| > `f.onRefresh(func as Function, context = Invalid as Object)` | ||
| > `featurevisorSDK.getRevision() as String` | ||
| ### `f.onUpdate` | ||
| ### `featurevisorSDK.isReady` | ||
| Adds on update callback which will be called after a successful datafile refresh when it has been changed compared to the previous one. | ||
| > `featurevisorSDK.isReady() as Boolean` | ||
| > `f.onUpdate(func as Function, context = Invalid as Object)` | ||
| Check if the instance is ready to be used. | ||
| ### `f.clear` | ||
| ### `featurevisorSDK.refresh` | ||
| Stop refreshing and clear the whole instance. It needs to be initialized once again. | ||
| > `featurevisorSDK.refresh()` | ||
| > `f.clear()` | ||
| ### `f.getRevision` | ||
| Get the datafile revision. | ||
| > `f.getRevision() as String` | ||
| ### `f.isReady` | ||
| Check if the instance is ready to be used (the datafile is set). | ||
| > `f.isReady() as Boolean` | ||
| ### `f.refresh` | ||
| Manually refresh datafile. | ||
| ### `featurevisorSDK.setDatafile` | ||
| > `f.refresh()` | ||
| > `featurevisorSDK.setDatafile(datafile as Object)` | ||
| ### `f.setDatafile` | ||
| ### `featurevisorSDK.setStickyFeatures` | ||
| Set datafile manually. | ||
| > `featurevisorSDK.setStickyFeatures(stickyFeatures as Object)` | ||
| > `f.setDatafile(datafile as Object)` | ||
| ### `featurevisorSDK.startRefreshing` | ||
| ### `f.setStickyFeatures` | ||
| > `featurevisorSDK.startRefreshing()` | ||
| Set sticky features. | ||
| Start refreshing if refreshInterval was provided | ||
| > `f.setStickyFeatures(stickyFeatures as Object)` | ||
| ### `featurevisorSDK.stopRefreshing` | ||
| ### `f.startRefreshing` | ||
| > `featurevisorSDK.stopRefreshing()` | ||
| Resume or start refreshing if refreshInterval was provided. | ||
| Cancel refreshing | ||
| > `f.startRefreshing()` | ||
| ### `f.stopRefreshing` | ||
| Stop refreshing. | ||
| > `f.stopRefreshing()` | ||
| ## License <!-- omit in toc --> | ||
| MIT © Błażej Chełkowski |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
73458
1.35%534
15.84%