![Introducing Enhanced Alert Actions and Triage Functionality](https://cdn.sanity.io/images/cgdhsj6q/production/fe71306d515f85de6139b46745ea7180362324f0-2530x946.png?w=800&fit=max&auto=format)
Product
Introducing Enhanced Alert Actions and Triage Functionality
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
ember-compatibility-helpers
Advanced tools
Changelog
v1.2.7 (2023-10-30)
Readme
Provides flags for features in Ember, allowing you to write code that will work with whatever version the consuming application is on. This addon is intended to help addon authors write backwards/forwards compatibility code.
The flags are replaced at build time with boolean literals (true
or false
)
by a Babel transform. When ran through a minifier (with dead code elimination) the entire section will be stripped, meaning that the section of code which is not used
will not be added to production builds - zero cost compatibility!
ember install ember-compatibility-helpers
import {
// General functions for checking against Ember version
gte,
lte,
// Flags for specific Ember functionality
HAS_UNDERSCORE_ACTIONS,
HAS_MODERN_FACTORY_INJECTIONS,
IS_GLIMMER_2,
IS_RECORD_DATA,
SUPPORTS_FACTORY_FOR,
SUPPORTS_GET_OWNER,
SUPPORTS_SET_OWNER,
SUPPORTS_NEW_COMPUTED,
SUPPORTS_INVERSE_BLOCK,
SUPPORTS_CLOSURE_ACTIONS,
SUPPORTS_UNIQ_BY_COMPUTED
} from 'ember-compatibility-helpers';
More welcome, open an issue or a PR!
Version strings passed to version checker functions, such as gte
or lte
, must be fully qualified versions. Version ranges or shorthands are not supported.
// Do this:
lte('3.13.0-beta.1')
// Not this:
lte('3.12'); // won't work!
lte('^3.12.0'); // won't work!
import Component from '@glimmer/component';
import { get } from '@ember/object';
import { gte } from 'ember-compatibility-helpers';
export default class MyComponent extends Component {
get aProp() {
if (gte('4.0.0')) {
return this.args.aProxy.name;
} else {
return get(this.args.aProxy, 'name');
}
}
}
import Component from '@glimmer/component';
import { get } from '@ember/object';
import { gte } from 'ember-compatibility-helpers';
export default class MyComponent extends Component {
get aProp() {
if (gte('my-ember-addon', '1.2.3')) {
return this.args.newProp;
} else {
return this.args.oldProp;
}
}
}
import Component from '@ember/component';
import { computed } from '@ember/object';
import { SUPPORTS_NEW_COMPUTED } from 'ember-compatibility-helpers';
function fooMacro() {
if (SUPPORTS_NEW_COMPUTED) {
return computed({
get() {
return this.get('foo');
},
set(key, value) {
this.set('foo', value);
return value
}
});
} else {
return computed(function(key, value) {
if (arguments.length === 2) {
this.set('foo', value);
return value;
}
return this.get('foo');
})
}
}
export default Component.extend({
bar: fooMacro()
});
git clone <repository-url>
this repositorycd ember-compatibility-helpers
yarn
npm test
FAQs
Zero-cost compatibility flags and helpers for Ember.js
The npm package ember-compatibility-helpers receives a total of 115,274 weekly downloads. As such, ember-compatibility-helpers popularity was classified as popular.
We found that ember-compatibility-helpers demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
Security News
Polyfill.io has been serving malware for months via its CDN, after the project's open source maintainer sold the service to a company based in China.
Security News
OpenSSF is warning open source maintainers to stay vigilant against reputation farming on GitHub, where users artificially inflate their status by manipulating interactions on closed issues and PRs.