Functions

safeSet(context: object, key: string, value: string): any

Use this util to safely set a property in callbacks or later runs.

import Component from '@ember/component';
import safeSet from "../utils/safe-set";
import { later } from "f@ember/runloop";
export default Component.extend({
  state: null,
  action: {
    setFocusState() {
      later(() => {
        safeSet(this, 'state', 'focussed');
      }, 1000);
    }
  }
});

Import Path

        import

        { safeSet }

        from
        '@freshworks/button/utils/safe-set';
      

Params

context object reference of the instance
key string name of the property that needs to be modified
value string value to be updated