{"_id":"546467902c77331a00252bb8","user":"54523f0604160008005b1cc0","version":{"_id":"54523fec04160008005b1ccb","project":"54523fec04160008005b1cc8","__v":3,"createdAt":"2014-10-30T13:41:00.515Z","releaseDate":"2014-10-30T13:41:00.515Z","categories":["54523fec04160008005b1ccc","546458255871e90800f5014e","56117ff28c76a61900fd06d5"],"is_deprecated":true,"is_hidden":false,"is_beta":false,"is_stable":false,"codename":"","version_clean":"1.0.0","version":"1.0"},"category":{"_id":"546458255871e90800f5014e","__v":5,"pages":["546467902c77331a00252bb8","54646990f42a472000b0c4b2","546469adf42a472000b0c4b4","546469f0f42a472000b0c4b7","546a2a51a3b67a0e00559c18"],"version":"54523fec04160008005b1ccb","project":"54523fec04160008005b1cc8","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2014-11-13T07:05:09.147Z","from_sync":false,"order":0,"slug":"rollmyfile-javascript-api","title":"rollMyFile JavaScript API"},"githubsync":"","is_link":false,"__v":7,"project":"54523fec04160008005b1cc8","updates":[],"next":{"pages":[],"description":""},"createdAt":"2014-11-13T08:10:56.968Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"basic_auth":false,"results":{"codes":[]},"settings":"","try":true,"auth":"never","params":[],"url":""},"isReference":false,"order":1,"body":"To initialize client access rollMyFile API you need to register your app at ???. Once you get a n API key, you can add rollMyFile API client to your page.\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"Domain whitelisting\",\n  \"body\": \"The API key is tied to the domain, when you create an application. You can then use this key to access rollMyFile API **only** on that domain.\"\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"var key = \\\"SeCur3AP1K3y\\\";\\n\\nvar rollMyFile = new RollMyFile(key, function() {\\n  // oninitcomplete handler\\n});\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\nDuring initialization rollMyFile API client makes a number of requests to rollApp backend. Until these requests are processed you should not use *isBrowserSupported* and *getSupportedExtensions*. If you need to perform your own initialization based, e.g. add \"open online\" button only for files, which can be open, you should do that in `oninitcomplete` handler.","excerpt":"","slug":"rollmyfile-js-constructor","type":"fn","title":"new RollMyFile (key, oninintcomplete)"}

new RollMyFile (key, oninintcomplete)


To initialize client access rollMyFile API you need to register your app at ???. Once you get a n API key, you can add rollMyFile API client to your page. [block:callout] { "type": "warning", "title": "Domain whitelisting", "body": "The API key is tied to the domain, when you create an application. You can then use this key to access rollMyFile API **only** on that domain." } [/block] [block:code] { "codes": [ { "code": "var key = \"SeCur3AP1K3y\";\n\nvar rollMyFile = new RollMyFile(key, function() {\n // oninitcomplete handler\n});", "language": "javascript" } ] } [/block] During initialization rollMyFile API client makes a number of requests to rollApp backend. Until these requests are processed you should not use *isBrowserSupported* and *getSupportedExtensions*. If you need to perform your own initialization based, e.g. add "open online" button only for files, which can be open, you should do that in `oninitcomplete` handler.