{"_id":"@cantoo/cantoo-client","_rev":"8-070b5af207201844c0beedeee0c26167","name":"@cantoo/cantoo-client","dist-tags":{"latest":"1.0.2"},"versions":{"1.0.1":{"name":"@cantoo/cantoo-client","version":"1.0.1","author":{"name":"Cantoo - Inschool SAS"},"license":"MIT","_id":"@cantoo/cantoo-client@1.0.1","maintainers":[{"name":"sharcoux","email":"f.billioud@gmail.com"},{"name":"netoguimaraes","email":"joao.neto.guimaraes@gmail.com"},{"name":"marcospgs","email":"marcospg-silva@hotmail.com"},{"name":"ribeirofmatheus","email":"matheus_f.ribeiro@hotmail.com"},{"name":"ja0n","email":"jamonsterr@gmail.com"},{"name":"matheusrdsantos","email":"matheus.r.d.s10@hotmail.com"}],"dist":{"shasum":"b28d16c293eb74d37be56e9685d86b1eee67e975","tarball":"https://registry.npmjs.org/@cantoo/cantoo-client/-/cantoo-client-1.0.1.tgz","fileCount":6,"integrity":"sha512-ypo5amNSnykMmkCeZToayXl6O8IiPFHpXd6JgV1+d33zeekyzDWKuYLzSL8tf3Zvbtasi9ahmGxQahI8i7u4hQ==","signatures":[{"sig":"MEUCIQCMekkdu1iqz/9Qzdk3v9KVLlptBMPq5Tr5Vgj+779UVwIgd8qq/3pWr2U+CFz9s4S5aRzZnA+uhB6cU363f2ZwyTw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":9475,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjkU5NACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpcZA//fTFkL/CYgLhyovX04o0+65wp4wFSOBdfMY7Kg+ICpcP8AqEN\r\nvW+S8BxrQ/khcOhSZn6vKXObTnblSJZ9qgcblDgZz2UkITmZOgbYBXat6rvS\r\nXLMYUUOnpb6ftneHLamqWFYjD944CkYyuMFpn07S+Rr/w5d5aXXFm4W+WDUD\r\no+aGIPQ+pYTArxgZYUvhOx9xxrTz2DujkHxXraqugsfTmMRohrx8hy7ONh8U\r\nIZ+bFjluP8fCu2Jsshe24jhgr8R8C+5KWTDXVO6uButm1EPsn/PpIx/OwAbR\r\nRf0VCiQKZWMDMo5l3QN9nuHXiTGgn/XsmQzYGG+/5L/xYQ54yroJ8BlMOzIS\r\nRx2Kb3HI9k3J31zUerHih4FcUHqCZolyArKj76ihkQ0BtB5Z82rMPoU2rruQ\r\n+RZK4uX3wJwztJmoyOJkommkfgmrZSfbKxEETot2xf2jzMcS5ggQYTWL4Vf5\r\nvsED5VDceurYB+mIz1HKQ/DP1N3ZO9tJQzHOV4wU+AJrxMYsppmc2qtQhpcx\r\nrLxbTLFrx1d1OxB8B8zgV5O5VZneXfM36q/qzziz2yRkHBt+djdOEgdX9KCD\r\nThHL1JFZ1G95GTSK1o3XU+84tdESYjKvHszJCMF2dYAqj3wJKDSESuHI7ZR1\r\nylsRPyOc/qXZUHQNR9XP6eXn3tP1MOQNxP0=\r\n=q2cC\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cantooApi.js","gitHead":"88413d2adb0182ef9a5932807789f4d1a8cf984e","scripts":{"test":"echo \"Error: no test specified\" && exit 1","release":"./release.sh"},"_npmUser":{"name":"sharcoux","email":"f.billioud@gmail.com"},"_npmVersion":"8.1.0","description":"A client for integration inside Cantoo Scribe","directories":{},"_nodeVersion":"14.21.1","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/cantoo-client_1.0.1_1670467148813_0.022523136563178392","host":"s3://npm-registry-packages"}},"1.0.2":{"name":"@cantoo/cantoo-client","version":"1.0.2","author":{"name":"Cantoo - Inschool SAS"},"license":"MIT","_id":"@cantoo/cantoo-client@1.0.2","maintainers":[{"name":"sharcoux","email":"f.billioud@gmail.com"},{"name":"netoguimaraes","email":"joao.neto.guimaraes@gmail.com"},{"name":"marcospgs","email":"marcospg-silva@hotmail.com"},{"name":"ribeirofmatheus","email":"matheus_f.ribeiro@hotmail.com"},{"name":"ja0n","email":"jamonsterr@gmail.com"},{"name":"matheusrdsantos","email":"matheus.r.d.s10@hotmail.com"}],"dist":{"shasum":"9cf5fbec04160c0d53c60be5029b82eda83a689a","tarball":"https://registry.npmjs.org/@cantoo/cantoo-client/-/cantoo-client-1.0.2.tgz","fileCount":6,"integrity":"sha512-fVRu41pbfjsOcUIEkxnd8tUbeaI0rTs4IY/FfNrQYUU539DUJBJlkX8IqhTf/mfHGspa+rn/1G4xv31dI3w7iQ==","signatures":[{"sig":"MEUCIB9D+cPx/+Tr1JafPup8ZLE3AFjCwyQJ6pygAAZa8oznAiEAiJ1DUaImAlKR/hZD/n775GbwgJKJGL0IZnmfGtV2d7c=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":9562,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj7Pv5ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmrqjw//QWEZWdi23d0o6PnSgBEkPe2mkIHenkPm6dC0zpvN7Dgdxfou\r\nfHL/dlACYIhi81Jut/OhDNgIUj0SL/3fDPfUplxPnSlpWnQRnujyXe30GnoM\r\nj/k1ifoAw4nz4DoQRmK09yO8SrIjMNfSGT165I6xl5k1FtgrntHkXMqwYvqV\r\nBkgU98V9Y+8/MTVcWx0eBZdtmAio2u2giMqDNWBTzr2ATNXS6aDGQAmxczot\r\n1T7h0FomddoikRIJX2G6pUg0UTkpVn8XsXbAlkdR1b7bn+3xsOfDLei5yWdv\r\nigbG6EjXUJ9tQ7vI4UGYBwamZexaw/2m8i3xWLdZkEn3iiiejuGWUqifupfH\r\nwn4PzabST/iFBh9LGf9fYoClYiGrLjtRZw1/AojH4q63nukm6uZJapuyNLe1\r\nrIUKlF6QOfI5Tt+T+k6RT7+X8zCZeGtgswWc3f6lc4UKqp6Y72e2M8GN7hmC\r\ngZTDHO4kmLhAdIHMiop2GRMRFM+d0IfGAk3oc6jiQzTtODaTbK3vHyQdxBgH\r\n/1Oat/NwgiOdTwhHITdPk+77wWzZyj3EwgHBqLrrNdwp/Tyn7oBGpwqvmUNt\r\nIxxGVgML4L4sr6ctkdusXnK0buLvId++IgAZXGGt1nU68qc/iWpbjMspBbg5\r\nzsyNosTcLawrnGuRMtwmnj0jesjaO5Iqhrg=\r\n=k3So\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cantooApi.js","gitHead":"ea87c6fb61aafbb508d31e88e1828d463df5e01f","scripts":{"test":"echo \"Error: no test specified\" && exit 1","release":"./release.sh"},"_npmUser":{"name":"sharcoux","email":"f.billioud@gmail.com"},"_npmVersion":"6.14.17","description":"A client for integration inside Cantoo Scribe","directories":{},"_nodeVersion":"14.21.2","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/cantoo-client_1.0.2_1676475385592_0.032951271460774034","host":"s3://npm-registry-packages"}}},"time":{"created":"2022-12-08T02:39:08.757Z","modified":"2026-05-05T16:34:04.668Z","1.0.1":"2022-12-08T02:39:09.011Z","1.0.2":"2023-02-15T15:36:25.875Z"},"author":{"name":"Cantoo - Inschool SAS"},"license":"MIT","description":"A client for integration inside Cantoo Scribe","maintainers":[{"email":"f.billioud@gmail.com","name":"sharcoux"},{"email":"matheus_f.ribeiro@hotmail.com","name":"ribeirofmatheus"},{"email":"matheus.r.d.s10@hotmail.com","name":"matheusrdsantos"},{"email":"gabrielnsdantas@gmail.com","name":"gabrielnsd"},{"email":"felipe@cantoo.fr","name":"felipecantoo"},{"email":"nicodemos54324@gmail.com","name":"nicodemos234"}],"readme":"# cantoo-client\n\nThis package will help you make your app compatible with Cantoo Scribe.\n\n## Getting started\n\nAdd the package to your project:\n\n`npm install cantoo@cantoo-client`\n\nAlternatively, you can download the latest version [here](), but you will have to manually update it when needed.\n\nThen, you will have to create a CantooClient instance:\n\n```js\nconst CantooClient = require('cantoo@cantoo-client')\nconst cantoo = new CantooClient()\n```\n\nNow, here are the main instructions that you will have to handle:\n\n---\n\n## Cantoo Scribe API\n\nThe methods that you should call:\n\n### loaded\n\nWhen the app is ready, you must call this method.\n\n```js\ninitMyApp().then(() => cantoo.loaded())\n```\n\n### changed\n\nCantoo Scribe needs to be aware when a change is available in your app. Call this method each time a change occurs that the user might want to save. Be aware that an internal debounce will happen to avoid flood, so don't worry about it.\n\n```js\ndoSomethingThatWillUpdateTheState()\ncantoo.updated()\n```\n\n### destroy\n\nWhen you want to clear all listeners set and free the memory hold by the CantooClient object, call the `destroy()` method.\n\n```js\ncantoo.destroy()\n```\n\n---\n\n## Cantoo Scribe requests handlers\n\n\n\n### onDocumentRequest\n\nCantoo Scribe sometimes needs the current document. You need to register a listener to that event, and it should return a string containing the data you would need to recreate the document, and an image (svg or png) that can best represent the current work of the user.\n\n```js\nconst generateDocument = async () => {\n  return {\n    doc: await gatherTheDataOfMyApp()\n    svg: await generatePicture()\n  }\n}\ncantoo.onDocumentRequest(generateDocument)\n```\n\n### onClearRequest\n\nCantoo Scribe might ask your app to clean up and be ready to generate a new document. Don't worry, the user would have had the chance to save the data if they needed to. There is nothing else to do but to clear the current document state.\n\n```js\nconst clearAll = async () => {\n  // Don't forget to await, or to return a promise so Cantoo Scribe knows when the document is ready\n  await flush()\n}\ncantoo.onClearRequest(clearAll)\n```\n\n### onLoadDocumentRequest\n\nCantoo Scribe might ask your app to load a new document. You will receive, as a string, the document data you provided in the `onDocumentRequest` method. This is your responsability to maintain retro-compatibility of those data accross versions of your app.\n\n```js\nconst loadDocument = async (data: string) => {\n  // Don't forget to await, or to return a promise so Cantoo Scribe knows when the document is ready\n  await loadTheDataInTheApp(data)\n}\ncantoo.onLoadDocumentRequest(loadDocument)\n```\n\n---\n\n## Methods summary\n\n### Cantoo Scribe API\n\n| Method | Parameters | Return value | Description |\n|:---|:---:|:---:|:---|\n| loaded | `void` | `void` | Call this method when the app is ready and fully loaded |\n| changed | `void` | `void` | Call this method each time your app state changed<br>and would now be represented by a different document.<br> This will be used to indicate the user that new data need saving |\n| destroy | `void` | `void` | Call this method when you want to free the memory and remove the listeners |\n\n### Cantoo Scribe Requests handlers\n\n| Method | Event | Return value | Description |\n|---|---|---|---|\n| onDocumentRequest | `void` | <code>Promise<<br>&nbsp;&nbsp;&#124; { doc: string; svg: string }<br>&nbsp;&nbsp;&#124; { doc: string; png: string }<br>></code> | Cantoo Scribe needs to save the current document.<br>Provide a method that will return the data<br>you will need to reconstruct the current state of your app,<br>and an illustration for the user, as png or svg. |\n| onClearRequest | `void` | `Promise<void>` | Cantoo Scribe wants to reset the document.<br>Provide a method that will clear the current state. |\n| onLoadDocumentRequest | `void` | `Promise<void>` | Cantoo Scribe want to load the provided data into your app.<br> Provide a method that will take that data and load it. |\n","readmeFilename":"README.md"}