createCustomElement - components

DanBye_KA2
Tera Contributor

Hi everyone,

[noob alert]

 

Id like to understand the three dots sometimes used in the createCustomElement JSON. For example, in the GIT examples (example-checklist and task-board-example, at the end of the JSON, there is...

 

...checklistActions,

and

...taskBoardActions

 

In other examples, the JSON does not eg (agent-assist-item)

Then again, in example-card there is a behaviours array. 

 

I can only assume, by the importing of an "actions" file in the ones that use three dots...

 

So, what does it do?

Why do the others not use the same convention?

Is there any best practise guidelines with the two?

 

Thanks

1 ACCEPTED SOLUTION

Brad Tilton
ServiceNow Employee
ServiceNow Employee

Hi Dan,

 

The three dots I believe is called the spread syntax in javascript and has a number of different uses. I don't believe we have any ServiceNow specific best practice guidance regarding it as it's a standard JS feature.

View solution in original post

2 REPLIES 2

Brad Tilton
ServiceNow Employee
ServiceNow Employee

Hi Dan,

 

The three dots I believe is called the spread syntax in javascript and has a number of different uses. I don't believe we have any ServiceNow specific best practice guidance regarding it as it's a standard JS feature.

Thanks Brad. 

I can see now that the "In an object literal, the spread syntax enumerates the properties of an object and adds the key-value pairs to the object being created."

Will be applied to the actionHandlers object in the action.js file.

Really appreciate your reply.