Exemplo n.º 1
0
    def getEntriesByType(self, entry_type: str):
        """
    Description:
    ------------
    The getEntriesByType() method returns a list of PerformanceEntry objects for a given type.
    The list's members (entries) can be created by making performance marks or
    measures (for example by calling the mark() method) at explicit points in time.

    Usage::

      performance.getEntriesByType("mark")

    Related Pages:

      https://developer.mozilla.org/en-US/docs/Web/API/Performance/getEntriesByType

    Attributes:
    ----------
    :param str entry_type: The type of entry to retrieve such as "mark".

    :return: A list of PerformanceEntry objects that have the specified type.
    """
        return JsArray.JsArray("window.performance.getEntriesByType('%s')" %
                               entry_type,
                               is_py_data=False)
Exemplo n.º 2
0
  def toArray(self):
    """
    Description:
    ------------
    THis is not a standard Javascript method for an object.
    It is only defined for some objects like the Datatable data()
    """
    from epyk.core.js.primitives import JsArray

    return JsArray.JsArray("%s.toArray()" % self.varId, isPyData=False, setVar=False)
Exemplo n.º 3
0
    def touches(self):
        """
    Description:
    ------------
    The touches property returns an array of Touch objects, one for each finger that is currently touching the surface.

    Related Pages:

      https://www.w3schools.com/jsref/event_touch_touches.asp
    """
        return JsArray.JsArray("event.shiftKey", isPyData=False)
Exemplo n.º 4
0
    def thresholds(self):
        """
    Description:
    ------------
    The IntersectionObserver interface's read-only thresholds property returns the list of intersection thresholds that was specified when the observer was instantiated with IntersectionObserver().
    If only one threshold ratio was provided when instanitating the object, this will be an array containing that single value.

    Related Pages:

      https://developer.mozilla.org/en-US/docs/Web/API/IntersectionObserver/thresholds
    """
        return JsArray.JsArray("%s.thresholds", isPyData=False)
Exemplo n.º 5
0
    def entries(self):
        """
    The entries() method returns an Array Iterator object with key/value pairs.

    Documentation
    https://www.w3schools.com/jsref/jsref_entries.asp
    https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/entries

    :return: A new Array, containing the selected elements
    """
        from epyk.core.js.primitives import JsArray

        return JsArray.JsArray("Object.entries(%s)" % self.varId)
Exemplo n.º 6
0
class DataLoop:
    """
  Description:
  -----------
  Data Class used for all the loop and map in the Javascript side.
  This will get the below attributes

  val   : The current value in the loop
  index : The index item
  arr   : The full array (only available in case of arrays, map, filter, every  )
  """
    val, index, arr = JsObject.JsObject("value"), JsNumber.JsNumber(
        "index", is_py_data=False), JsArray.JsArray("arr")
Exemplo n.º 7
0
    def getEntriesByName(self,
                         name: Union[primitives.JsDataModel, str],
                         entry_type: Optional[str] = None):
        """
    Description:
    ------------
    The getEntriesByName() method returns a list of PerformanceEntry objects for the given name and type.
    The list's members (entries) can be created by making performance marks or
    measures (for example by calling the mark() method) at explicit points in time.

    Usage::

      performance.getEntriesByName("Begin", "mark")

    Related Pages:

      https//developer.mozilla.org/en-US/docs/Web/API/Performance/getEntriesByName

    Attributes:
    ----------
    :param Union[primitives.JsDataModel, str] name: The name of the entry to retrieve.
    :param Optional[str] entry_type: Optional. The type of entry to retrieve such as "mark".

    :return: A list of PerformanceEntry objects that have the specified name and type
    """
        if name not in self.__marks:
            raise ValueError("Mark %s not defined in the performances" % name)

        name = JsUtils.jsConvertData(name, None)
        if entry_type is not None:
            return JsArray.JsArray(
                "window.performance.getEntriesByName(%s, %s)" %
                (name, entry_type),
                is_py_data=False)

        return JsArray.JsArray("window.performance.getEntriesByName(%s)" %
                               name,
                               is_py_data=False)
Exemplo n.º 8
0
    def getOwnPropertyNames(self, obj):
        """
    The Object.getOwnPropertyNames() method returns an array of all properties (including non-enumerable properties except for those which use Symbol) found directly in a given object.

    Documentation
    https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyNames

    :param obj: The object whose enumerable and non-enumerable properties are to be returned.

    :return: An JsArray of strings that corresponds to the properties found directly in the given object.
    """
        from epyk.core.js.primitives import JsArray

        return JsArray.JsArray("Object.getOwnPropertyNames(%s)" % obj.varId)
Exemplo n.º 9
0
    def keys(self):
        """
    Returns an array of enumerable properties

    Example
    jsObj.objects.get("MyObject").keys()

    Documentation
    https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys
    https://www.w3schools.com/js/js_object_es5.asp

    :return: A new Array, containing the selected elements
    """
        from epyk.core.js.primitives import JsArray

        return JsArray.JsArray("Object.keys(%s)" % self.varId, isPyData=False)
Exemplo n.º 10
0
    def getEntries(self):
        """
    Description:
    ------------
    The getEntries() method returns a list of all PerformanceEntry objects for the page.
    The list's members (entries) can be created by making performance marks or
    measures (for example by calling the mark() method) at explicit points in time.
    If you are only interested in performance entries of certain types or that have certain names,
    see getEntriesByType() and getEntriesByName().

    Related Pages:

      https://developer.mozilla.org/en-US/docs/Web/API/Performance/getEntries

    :return: An array of PerformanceEntry objects
    """
        return JsArray.JsArray("window.performance.getEntries()",
                               is_py_data=False)