Browse Source

Define abp.features API to abp.js

pull/5895/head
liangshiwei 6 years ago
parent
commit
10d735c01c
  1. 22
      docs/en/UI/AspNetCore/JavaScript-API/Features.md
  2. 15
      npm/packs/core/src/abp.js

22
docs/en/UI/AspNetCore/JavaScript-API/Features.md

@ -6,10 +6,24 @@
## Basic Usage
`abp.features.values` can be used to access to the all feature values.
````js
var excelExportFeatureValue = abp.features.values["ExportingToExcel"];
//Gets a value as string.
var value = abp.features.get('ExportingToExcel');
//Check the feature is enabled
var enabled = abp.features.isEnabled('ExportingToExcel.Enabled');
````
Then you can check the value of the feature to perform your logic.
## All Values
`abp.features.values` can be used to access to the all feature values.
An example value of this object is shown below:
````js
{
Identity.TwoFactor: "Optional",
ExportingToExcel.Enabled: "true",
...
}
````

15
npm/packs/core/src/abp.js

@ -750,5 +750,20 @@ var abp = abp || {};
return toUtc(date);
}
};
/* FEATURES *************************************************/
abp.features = abp.features || {};
abp.features.values = abp.features.values || {};
abp.features.isEnabled = function(name){
var value = abp.features.get(name);
return value == 'true' || value == 'True';
}
abp.features.get = function (name) {
return abp.features.values[name];
};
})();

Loading…
Cancel
Save