JSMA slices

Overview

The JSMA slices provides functionality for accessing slices.

What can JSMA slices do for me?

You could easily use the JSMA slices to get information about the current slice

Index

Usage

reading data

Here is an example on how to read data from a JSMA slices:

...
slices.findByName('testing'); // => slice
...

Methods

The JSMA slices provides the following methods:

slice slices.create(options={})

Creates and returns a JSMA slice with the given options and description.

Example

...
var message = "Created by " + customers.current.displayName;
var desc = "This is for testing";
var slice = slices.create({ name: message, description: desc });
...

Parameter options (required)

slice slices.current

Returns a JSMA slice for the current slice, if available.

Example

...
var slice = slices.current;
if (slice !== null)
{
   return createStandardResult("there is no current slice");
}
...

slices.delete(slice)

Deletes a JSMA slice

Example

...
var slice = slices.findByName('test'); // => slice
slices.delete(slice);
...

Parameter slice (required)

The slice to be deleted

slice slices.findById(id)

Returns a JSMA slice when a slice is found for the given id.

Avoid usage of findById

Ids change whenever a package is reimported. So please avoid using ids whenever possible. Also delivering contents to users by id might make it possible for users to flip through the files (and by that see contents of others possibly) by changing the ids in requests.

Example

...
var slice = slices.findById(27); // => slice
...

Parameter id (required)

The slice id for the lookup.

slice slices.findByName(name)

Returns a JSMA slice when a slice is found for the given name.

Example

...
var slice = slices.findByName('test'); // => slice
...

Parameter name (required)

The slice name for the lookup.

slices.switch(slice)

Switches the current slice to the given slice.

Example

...
var slice = slices.create({ name: message });
slices.switch(slice );
...

Parameter slice (required)

The slice to switch to.