{"_id":"57dea97d0047a2170065e093","version":{"_id":"57b96d6b1d08500e00bf81d1","__v":7,"project":"54861bb654b3ce0b00367292","createdAt":"2016-08-21T08:59:23.326Z","releaseDate":"2016-08-21T08:59:23.326Z","categories":["57b96d6b1d08500e00bf81d2","57b96d6b1d08500e00bf81d3","57b96d6b1d08500e00bf81d4","57b96d6b1d08500e00bf81d5","57b96d6b1d08500e00bf81d6","57b96d6b1d08500e00bf81d7","57b96d6b1d08500e00bf81d8","57b96d6b1d08500e00bf81d9","57b96d6b1d08500e00bf81da","57b96d6b1d08500e00bf81db","57b96d6b1d08500e00bf81dc","57b97748306b9b0e001dd53f","57d12c6c1227b40e0044908a","57d51ad68191880e008bb51b","57d52b5cf350090e00fe073e","57d5468a17b492170053a3f0","57df9df05927cb0e002bce1e"],"is_deprecated":true,"is_hidden":false,"is_beta":false,"is_stable":false,"codename":"","version_clean":"4.0.0","version":"4.0"},"category":{"_id":"57b97748306b9b0e001dd53f","__v":0,"version":"57b96d6b1d08500e00bf81d1","project":"54861bb654b3ce0b00367292","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2016-08-21T09:41:28.604Z","from_sync":false,"order":6,"slug":"android-setup","title":"Cordova / Essentials KIt"},"parentDoc":null,"project":"54861bb654b3ce0b00367292","user":"548d74b716fc980b00e2a786","__v":1,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-09-18T14:49:33.452Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"settings":"","results":{"codes":[]},"auth":"required","params":[],"url":""},"isReference":false,"order":1,"body":"[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Actions\"\n}\n[/block]\nActions is the ability to extend functionality on clickable buttons in an experience, to lean more about actions, please visit knowledge base  <a href=\"http://helpdesk.elasticode.com/articles/3068-actions-and-how-to-work-with-them\" target=\"_blank\">here</a>\n\nHere is a way you can extend that with your own functionality\nIn order to add an action, simply pass an object to ``setActions`` method with properties:\n* Property name - A string representation of your code block\n* Property value - A JavaScript function to be called once action is triggered, that gets a  context information you would like it to preserve (state).\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"window.elasticode.setActions({\\n        \\\"Show video\\\" : function (context){\\n          // video showing logic\\n       }\\n});\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\nOnce you will ad this, this action will immediately populate as an option in the action option box:\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/1557b18-2323.png\",\n        \"2323.png\",\n        620,\n        365,\n        \"#34648e\"\n      ],\n      \"sizing\": \"80\",\n      \"border\": true\n    }\n  ]\n}\n[/block]","excerpt":"Cordova / Essentials KIt: Extra setup / Actions","slug":"extra-setup-actions","type":"basic","title":"Extra setup / Actions"}

Extra setup / Actions

Cordova / Essentials KIt: Extra setup / Actions

[block:api-header] { "type": "basic", "title": "Actions" } [/block] Actions is the ability to extend functionality on clickable buttons in an experience, to lean more about actions, please visit knowledge base <a href="http://helpdesk.elasticode.com/articles/3068-actions-and-how-to-work-with-them" target="_blank">here</a> Here is a way you can extend that with your own functionality In order to add an action, simply pass an object to ``setActions`` method with properties: * Property name - A string representation of your code block * Property value - A JavaScript function to be called once action is triggered, that gets a context information you would like it to preserve (state). [block:code] { "codes": [ { "code": "window.elasticode.setActions({\n \"Show video\" : function (context){\n // video showing logic\n }\n});", "language": "javascript" } ] } [/block] Once you will ad this, this action will immediately populate as an option in the action option box: [block:image] { "images": [ { "image": [ "https://files.readme.io/1557b18-2323.png", "2323.png", 620, 365, "#34648e" ], "sizing": "80", "border": true } ] } [/block]