Skip to content
This repository was archived by the owner on May 1, 2020. It is now read-only.
This repository was archived by the owner on May 1, 2020. It is now read-only.

returnType ignored by some fatories #9

Description

@sukima

I found two cases where the return value from a factory does not match the returnType defined in the supplied api.jsca.

Of note Ti.Database.open does not return a Ti.Database.DB object. To test see if the object returned has anexecute()` method.

Ti.UI.iOS.createToolbar does not return a Ti.UI.iOS.Toolbar object. I found it is missing the show() and hide() methods inherited from Ti.UI.View.

Is it possible that the returnType in the api.jsca is being ignored? I eventually had to polyfill my methods:

global.Ti.UI.iOS.createToolbar = (props) ->
    toolbar = {}
    toolbar[key] = val for key,val of Ti.UI.iOS.Toolbar
    toolbar[key] = val for key,val of props
    toolbar

In JS:

global.Ti.UI.iOS.createToolbar = function(props) {
  var key, toolbar, val, _ref;
  toolbar = {};
  _ref = Ti.UI.iOS.Toolbar;
  for (key in _ref) {
    val = _ref[key];
    toolbar[key] = val;
  }
  for (key in props) {
    val = props[key];
    toolbar[key] = val;
  }
  return toolbar;
};

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions