All Projects → justgage → reason-cookie

justgage / reason-cookie

Licence: MIT license
A simple way to use cookies in Reason (OCaml) on the frontend. 🍪

Programming Languages

HTML
75241 projects
javascript
184084 projects - #8 most used programming language
CSS
56736 projects
ocaml
1615 projects

Projects that are alternatives of or similar to reason-cookie

Vue Warehouse
A Cross-browser storage for Vue.js and Nuxt.js, with plugins support and easy extensibility based on Store.js.
Stars: ✭ 161 (+794.44%)
Mutual labels:  cookie, cross-browser
bs-react-fela
BuckleScript bindings for react-fela
Stars: ✭ 21 (+16.67%)
Mutual labels:  reasonml
bs-remotedata
RemoteData and WebData to use with bs-fetch for BuckleScript
Stars: ✭ 18 (+0%)
Mutual labels:  reasonml
universalSmoothScroll
A cross-browser smooth-scrolling API which supports multiple and interruptable scroll-animations on all DOM's elements, even at the same time!
Stars: ✭ 46 (+155.56%)
Mutual labels:  cross-browser
mUtils
JavaScript常用方法
Stars: ✭ 59 (+227.78%)
Mutual labels:  cookie
solar-weather
React Native Weather App w. Realm, Redux, ReasonReact & Forecast.io
Stars: ✭ 13 (-27.78%)
Mutual labels:  reasonml
lwt-node-starter
A simple starter for lwt-node
Stars: ✭ 13 (-27.78%)
Mutual labels:  reasonml
darknet
php ffi darknet
Stars: ✭ 21 (+16.67%)
Mutual labels:  yolo
yamete
Yamete - Hentai downloader in PHP CLI - Easy site downloader PHP system
Stars: ✭ 63 (+250%)
Mutual labels:  easy-to-use
ofxOpenCvDnnObjectDetection
OpenCV based DNN Object Detection Library for Openframeworks
Stars: ✭ 34 (+88.89%)
Mutual labels:  yolo
dynamic-app
Dynamic Forms Builder are reusable and make building large-scale applications easier (Easy Peasy)
Stars: ✭ 15 (-16.67%)
Mutual labels:  easy-to-use
restio
HTTP Client for Dart inspired by OkHttp
Stars: ✭ 46 (+155.56%)
Mutual labels:  cookie
revery-packager
Helper utility to package Revery applications into installable app bundles
Stars: ✭ 38 (+111.11%)
Mutual labels:  reasonml
streaming
Fast, safe and composable streaming abstractions.
Stars: ✭ 104 (+477.78%)
Mutual labels:  reasonml
Vehicle-Detection
Vehicle Detection Using Deep Learning and YOLO Algorithm
Stars: ✭ 96 (+433.33%)
Mutual labels:  yolo
YOLOV2-Tensorflow-2.0
Just another YOLO V2 implementation. Train your own dataset in a jupyter notebook!
Stars: ✭ 46 (+155.56%)
Mutual labels:  yolo
reason-tree-sitter
ReasonML bindings for tree-sitter
Stars: ✭ 22 (+22.22%)
Mutual labels:  reasonml
FormToolbar
Simple, movable and powerful toolbar for UITextField and UITextView.
Stars: ✭ 85 (+372.22%)
Mutual labels:  easy-to-use
OpenCV-Flask
🐛 🐛 Opencv视频流传输到网页浏览器并做目标检测 🐛 🐛
Stars: ✭ 35 (+94.44%)
Mutual labels:  yolo
vehicle-rear
Vehicle-Rear: A New Dataset to Explore Feature Fusion For Vehicle Identification Using Convolutional Neural Networks
Stars: ✭ 99 (+450%)
Mutual labels:  yolo

Reason Cookie Logo

🍪 ReasonCookie

A simple way to use cross-browser cookies that contain JSON.

Note this wraps js-cookie

Is it ready for prime time?

These are just some simple bindings to the library it wraps. I've used it on some side projects but it should be reasonably good. The underlying library is pretty battle tested and can even work in older browsers.

Install

npm install --save @justgage/reason-cookie

Then in your bsconfig.json.

  "bs-dependencies": ["@justgage/reason-cookie"],

API 😋

Working with string values

open JustgageReasonCookie;

Cookie.getAsString("hello") /* None */
Cookie.setString("hello", "test");
Cookie.getAsString("hello") /* Some("test") */

Working with JSON

open JustgageReasonCookie;

let obj = Js.Dict.empty();
Js.Dict.set(obj, "a", Js.Json.number(2.));
let obj = Js.Json.object_(obj);

Cookie.setJson("hello", obj);

let maybeCookie = Cookie.getAsJson("hello");

Set path/expiry

  • expires: number of days till it's gone.
  • path: this scopes it to a page on your website (note: haven't used this personally)

(see js-cookie for more uses)

open JustgageReasonCookie;

Cookie.setJsonConfig(
  "hello",
  obj,
  Cookie.makeConfig(~path="", ~expires=2, ()),
);

Contribute?

Best thing somone can do is just use it and find any problems it has.

Absolutely! Just make an issue. Please note that I usually ask people to make the changes themselves.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].