{"action":"created","issue":{"url":"https://api.github.com/repos/Jasonette/JASONETTE-iOS/issues/36","repository_url":"https://api.github.com/repos/Jasonette/JASONETTE-iOS","labels_url":"https://api.github.com/repos/Jasonette/JASONETTE-iOS/issues/36/labels{/name}","comments_url":"https://api.github.com/repos/Jasonette/JASONETTE-iOS/issues/36/comments","events_url":"https://api.github.com/repos/Jasonette/JASONETTE-iOS/issues/36/events","html_url":"https://github.com/Jasonette/JASONETTE-iOS/issues/36","id":188777902,"number":36,"title":"Add \"events\" field to components","user":{"login":"frostymarvelous","id":923493,"avatar_url":"https://avatars.githubusercontent.com/u/923493?v=3","gravatar_id":"","url":"https://api.github.com/users/frostymarvelous","html_url":"https://github.com/frostymarvelous","followers_url":"https://api.github.com/users/frostymarvelous/followers","following_url":"https://api.github.com/users/frostymarvelous/following{/other_user}","gists_url":"https://api.github.com/users/frostymarvelous/gists{/gist_id}","starred_url":"https://api.github.com/users/frostymarvelous/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/frostymarvelous/subscriptions","organizations_url":"https://api.github.com/users/frostymarvelous/orgs","repos_url":"https://api.github.com/users/frostymarvelous/repos","events_url":"https://api.github.com/users/frostymarvelous/events{/privacy}","received_events_url":"https://api.github.com/users/frostymarvelous/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-11-11T14:59:28Z","updated_at":"2016-11-24T19:29:19Z","closed_at":null,"body":"This is an enhancement to Jason to accommodate a more powerful event system.\r\nThe current system allows you to respond to only a default `event` which is quite limiting.\r\n\r\nWhat I propose is to add an `events` field. This will be an `array` of `events` with their corresponding actions.\r\nThis does not supersede the current implementation as the default `action` field will still remain and behave as expected. This new addition will only be for advanced usage.\r\n\r\nThis enhancement should support existing action mechanisms including `inline actions`, `trigger actions` and `href actions`.\r\n\r\n**Spec Considerations**\r\n\r\n- Any valid `action` and `href` should can be used to respond to an event\r\n- Event names should use `underscore_case`\r\n- Components should have a list of valid events which will be checked against during and fail if an event is not supported to help in development. This would be nice to have at \"compile\" (parse) stage, but if implementation would slow down parsing, we can go with doing this at run-time , failing while in `development` mode and reporting them in `production`.\r\n\r\n**Examples**\r\n\r\n1. Inline Actions\r\n```\r\n{\r\n  \"type\": \"label\",\r\n  \"text\": \"Refresh\",\r\n  \"action\": {\r\n    \"type\": \"$util.banner\",\r\n    \"options\": {\r\n      \"title\": \"Default action\",\r\n      \"description\": \"This is a default action\"\r\n    }\r\n  },\r\n  \"events\": {\r\n    \"click\": {\r\n      \"type\": \"$util.banner\",\r\n      \"options\": {\r\n        \"title\": \"Event action\",\r\n        \"description\": \"This is an event action\"\r\n      }\r\n    }\r\n  }\r\n}\r\n```\r\n\r\n2. Trigger Actions\r\n\r\n```\r\n{\r\n  \"type\": \"label\",\r\n  \"text\": \"Refresh\",\r\n  \"action\": {\r\n    \"trigger\": \"refresh_view\"\r\n  },\r\n  \"events\": {\r\n    \"click\": {\r\n      \"trigger\": \"refresh_view\"\r\n    }\r\n  }\r\n}\r\n```\r\n\r\n3. Href Actions\r\n\r\n```\r\n{\r\n  \"type\": \"label\",\r\n  \"text\": \"Refresh\",\r\n  \"action\": {\r\n    \"href\": {\r\n      \"url\": \"https://www.twitter.com/gliechtenstein\",\r\n      \"view\": \"web\"\r\n    }\r\n  },\r\n  \"events\": {\r\n    \"click\": {\r\n      \"href\": {\r\n        \"url\": \"https://www.twitter.com/gliechtenstein\",\r\n        \"view\": \"web\"\r\n      }\r\n    }\r\n  }\r\n}\r\n```\r\n\r\n4. Multiple events\r\n\r\n```\r\n{\r\n  \"type\": \"label\",\r\n  \"text\": \"Refresh\",\r\n  \"events\": {\r\n    \"click\": {\r\n      \"type\": \"$util.banner\",\r\n      \"options\": {\r\n        \"title\": \"Event action\",\r\n        \"description\": \"This is an event action\"\r\n      }\r\n    },\r\n    \"change\": {\r\n      \"trigger\": \"refresh_view\"\r\n    }\r\n  }\r\n}\r\n```\r\n\r\nIf you want fancy a quick laugh, check out https://github.com/CocoaPods/CocoaPods/issues/6158"},"comment":{"url":"https://api.github.com/repos/Jasonette/JASONETTE-iOS/issues/comments/262835370","html_url":"https://github.com/Jasonette/JASONETTE-iOS/issues/36#issuecomment-262835370","issue_url":"https://api.github.com/repos/Jasonette/JASONETTE-iOS/issues/36","id":262835370,"user":{"login":"gliechtenstein","id":16613330,"avatar_url":"https://avatars.githubusercontent.com/u/16613330?v=3","gravatar_id":"","url":"https://api.github.com/users/gliechtenstein","html_url":"https://github.com/gliechtenstein","followers_url":"https://api.github.com/users/gliechtenstein/followers","following_url":"https://api.github.com/users/gliechtenstein/following{/other_user}","gists_url":"https://api.github.com/users/gliechtenstein/gists{/gist_id}","starred_url":"https://api.github.com/users/gliechtenstein/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gliechtenstein/subscriptions","organizations_url":"https://api.github.com/users/gliechtenstein/orgs","repos_url":"https://api.github.com/users/gliechtenstein/repos","events_url":"https://api.github.com/users/gliechtenstein/events{/privacy}","received_events_url":"https://api.github.com/users/gliechtenstein/received_events","type":"User","site_admin":false},"created_at":"2016-11-24T19:29:19Z","updated_at":"2016-11-24T19:29:19Z","body":"Today I am working on connecting local variables with textfields (Almost there!) and just had an idea about this. \r\n\r\nWhat about `\"on\"` instead of `\"events\"`? If you compare \"on\" with \"events\", \"on\" is pretty clear what it means (assuming you're familiar with basic programming), where as \"events\" could mean anything from \"this component creates these events\", to \"this component responds to these events\". \r\n\r\nAlso it's consistent with web programming syntax (javascript's `onClick` or jQuery's `$el.on(...)` syntax.\r\n\r\nSo the markup would look something like:\r\n\r\n```json\r\n{\r\n  \"type\": \"textfield\",\r\n  \"name\": \"username\",\r\n  \"on\": {\r\n    \"change\": {\r\n      \"type\": \"$util.toast\",\r\n      \"options\": {\r\n        \"text\": \"Updated content to {{$get.username}}!\"\r\n      },\r\n      \"success\": {\r\n        \"trigger\": \"refresh_view\"\r\n      }\r\n    },\r\n    \"focus\": {\r\n      \"type\": \"$util.banner\",\r\n      \"options\": {\r\n        \"title\": \"Editing\",\r\n        \"description\": \"Now started editing!\"\r\n      }\r\n    }\r\n  }\r\n}\r\n```\r\n\r\nPersonally I am satisfied, but if there's something I'm missing, please share :)"}}
{"actor":{"display_login":"gliechtenstein"}}