Members
-
componentName :String
-
Description
A unique name that identifies the component. Use the component name when getting a component, for example,
application.getComponent(componentName).Details
-
application :ComponentContainer
-
Description
The name which identify this kind of component. This name is used both for registering a new component and
getting a component implementation with ComponentContainerDetails
Methods
-
cancelableOn( event_name, handler ) → {void}
-
Description
Attaches an event handler to an event.
Parameters
Name Type Description event_nameString The name of the event to which the event handler will be attached.
handlerfunction The event handler method that will be invoked when event_name is triggered. This function can receive optionally one parameter representing the action parameter. Besides optionally can return a Deferred to details the execution of the trigger's callback. If the returned Deferred is rejected the trigger's callback wont be called
Returns
Details
-
cancelableOff( event_name, handler ) → {void}
-
Description
Detaches an event handler from an event.
Parameters
Name Type Description event_nameString The name of the event from which to detach the event handler. This argument is required.
handlerfunction The event handler that will be removed from the list of handlers attached to the event. This argument is required.
Returns
Details
-
extend( componentDefinition ) → {BaseComponent}
-
Description
Extends the current component and creates a child component.
Parameters
Name Type Description componentDefinitionObject An object with the appropriate properties and methods to create the component.
Returns
Details
-
cancelableDisable( event_name ) → {void}
-
Description
Disables all the event handlers attached to an event.
Parameters
Name Type Description event_nameString The name of the event.
Returns
Details
-
on( event_name, handler ) → {void}
-
Description
Attaches an event handler to an event name. Alias for CancelableEvents#cancelableOn.
Parameters
Name Type Description event_nameString The name of the event to attach to
handlerfunction Returns
Details
-
cancelableEnable( event_name ) → {Void}
-
Description
Re-enables all the event handlers attached to an event.
Parameters
Name Type Description event_nameString The name of the event.
Returns
Details
-
off( event_name, handler ) → {void}
-
Description
Detaches an event handler from an event name. Alias for CancelableEvents#cancelableOff.
Parameters
Name Type Description event_nameString The name of the event from which to detach the event handler.
handlerfunction Returns
Details
-
cancelableTrigger( event_name, ...args ) → {Deferred}
-
Description
Triggers an event with a set of arguments. If an event handler is rejected, the event handler callbacks will not be executed.
Parameters
Name Type Attributes Description event_nameString The name of the event to trigger.
argsparams <repeatable> One or more arguments that will be broadcast to all event handlers attached to the event.
Returns
Details
-
cancelableTriggerUnsafe( event_name, ...args ) → {Deferred}
-
Description
Triggers an event with a set of unsanitized arguments. If an event handler is rejected, the event handler callbacks will not be executed.
Parameters
Name Type Attributes Description event_nameString The name of the event to trigger.
argsparams <repeatable> One or more arguments that will be broadcast to all event handlers attached to the event.
Returns
Details
-
getConfig( key ) → {any}
-
Description
Gets the value of the specified configuration key. Use dot notation to access child objects and properties, for example,
component.getConfig('CheckoutApp.skipLogin'). The getConfig() method returns a copy of the original object. Any changes made to the retrieved object or key/value pair will not affect the original object.Note: You should always call this method with a configuration key. If you use this method without a key, the application attempts to return the entire Configuration object. On some pages in the application, this may return a very large object, which will result in an internal error (InternalError: too much recursion) or a range error (RangeError: Maximum call stack size exceeded).
var environment_component = container.getComponent("Environment"); if (environment_component) { var environment_cookiewarningsave = environment_component.getConfig("cookieWarningBanner.saveInCookie"); if (environment_cookiewarningsave === true) { // Do something here. } else { // Do something else here. } }Parameters
Name Type Description keyString The key you want to get the value of.
Returns
-
isPageGenerator() → {boolean}
-
Description
Checks whether the code is currently run by the SEO Page Generator or whether it is run by the web browser. See the SEO Page Generator topic in the NetSuite Help Center for more information.
Returns
-
getSiteSetting( [ key ] ) → {any}
-
Description
Gets the value of a key in the sitesettings JSON object. See the sitesettings help topic for more information about individual site settings.
var environment_component = container.getComponent("Environment"); if (environment_component) { var decimal_separator = environment_component.getSiteSetting("decimalseparator"); var logout_URL = environment_component.getSiteSetting("touchpoints.logout"); }Parameters
Name Type Attributes Description keyString <optional> The key you want to get the value of. Use dot notation to access child objects and properties. If
keyis empty, the entire sitesettings object is returned.Returns
-
getSession() → {Session}
-
Description
Gets current session information, including currency information, language settings, and price level.
var environment_component = container.getComponent("Environment"); var session = environment_component.getSession(); if (session.currency.code == "USD") { // Do something based on the currency code }Example of the object returned by this method:
{ currency: { code: "USD", currencyname: "USD", internalid: "1", isdefault: "T", name: "USD", symbol: "$", symbolplacement: 1 } language: { isDefault: "T", languagename: "English (U.S.)", locale: "en_US", name: "English (U.S.)" }, pricelevel: "5" }Returns
-
setTranslation( locale, keys )
-
Description
Adds or updates a translation key for the specified locale. Translations are added to the
SC.Translationsdictionary. If the key exists, this method overwrites its value. To avoid overwriting existing keys, you can use prefixes for the translation keys in your extension, for exampleMY.This promotion has expired.See the Localize Text in an Extension topic for more information about translations in extensions.
var environment_component = container.getComponent('Environment'); var translations_frfr = [ {key: 'Pre-Orders', value: 'Précommandes'}, {key: 'View Preorders', value: 'Visualiser précommandes'}, {key: 'Expected On', value: 'Date prévu'} ]; environment_component.setTranslation('fr_FR', translations_frfr);Parameters
Name Type Description localestring The language and region identifier of the translation. The locale is usually in the format [language]_[region], for example,
en_USorfr_FR.keysArray.<TranslationEntry> An array of objects containing the translation keys and their values.