Marionette JS Client

API Docs for: 1.7.1
Show:

Marionette.Actions Class

Actions is used to denote a set of actions that have to be executed in particular order.

Methods

cancel

() Object

cancel() can only be called if press() has already be called on this element. cancel() send 'touchcancel' event to whenever the finger is.

Returns:

Object:

self.

doubleTap

(
  • element
  • x
  • y
)
Object

doubleTap() performs a double tap on the element.

Parameters:

  • element Object

    Marionette.Element to double tap on.

  • x Number

    optional, x-coordinate relative to the top-left corner of the element of the last touch.

  • y Number

    optional, y-coordinate relative to the top-left corner of the element of the last touch.

Returns:

Object:

self.

flick

(
  • element
  • x1
  • y1
  • x2
  • y2
  • duration
)
Object

flick() sends a sequence of touch events: touchstart, touchmove, touchend. It scrolls the page in any direction within period of time provided(duration).

Parameters:

  • element Object

    Marionette.Element to double tap on.

  • x1 Number

    starting x-coordinates of the finger relative to the element.

  • y1 Number

    starting y-coordinates of the finger relative to the element.

  • x2 Number

    ending x-coordinates of the finger relative to the element.

  • y2 Number

    ending y-coordinates of the finger relative to the element.

  • duration Number

    optional, time needed for the flick gesture for complete.

Returns:

Object:

self.

longPress

(
  • element
  • time
)
Object

Sends 'touchstart', then wait for 'time' seconds, and send 'touchend' eventually. longPress() cannot follow any active touch, i.e. the finger must leave the screen before longPress() gets called.

Parameters:

Returns:

Object:

self.

move

(
  • element
)
Object

move() can only be called if press() has already be called on this element. move() send 'touchmove' event which moves the finger to target element.

Parameters:

Returns:

Object:

self.

moveByOffset

(
  • x
  • y
)
Object

moveByOffset() can only be called if press() has already be called on this element. moveByOffset() send 'touchmove' event.

Parameters:

  • x Number

    x-coordinate relative to the top-left corner of the target element of the last touch.

  • y Number

    y-coordinate relative to the top-left corner of the target element of the last touch.

Returns:

Object:

self.

perform

(
  • callback
)
Object

perform() will send the whole action chain built so far to the server side for execution.

Parameters:

  • callback Function

    callback when the perform completes.

Returns:

Object:

self.

press

(
  • element
  • x
  • y
)
Object

Send a 'touchstart' event to this element. If no coordinates are given, it will be targeted at the center of the element. If given, it will be targeted at the (x,y) coordinates relative to the top-left corner of the element.

Parameters:

  • element Object

    Marionette.Element to press on.

  • x Number

    optional, x-coordinate to tap, relative to the top-left corner of the element.

  • y Number

    optional, y-coordinate to tap, relative to the top-left corner of the element.

Returns:

Object:

self.

release

() Object

release() can only be called if press() has already be called on this element. Send 'touchend' event to whenever the finger is.

Returns:

Object:

self.

tap

(
  • element
  • x
  • y
)
Object

tap() performs a quick tap on the target. action.tap() is essentially action.press().release().

Parameters:

  • element Object

    Marionette.Element to press/release on.

  • x Number

    optional, x-coordinate relative to the top-left corner of the element of the last touch.

  • y Number

    optional, y-coordinate relative to the top-left corner of the element of the last touch.

Returns:

Object:

self.

wait

(
  • time
)
Object

wait() waits for specified time period.

Parameters:

  • time Number

    wait for "time" seconds.

Returns:

Object:

self.