0.0.43-alpha • Published 5 years ago

igiya v0.0.43-alpha

Weekly downloads
3
License
MIT
Repository
github
Last release
5 years ago

npm version

Igiya

igiya is a suggestion engine that use local storage. igiya is flexible and lightweight.

Installation

npm install igiya

Example

let Igiya = require('igiya');
IgiyaInstance = new Igiya();
	 
  //initialize igiya when page load
  IgiyaInstance.initialize("http://example.come/data.json");
	
  //trigger search
  $(document).on("keyup", ".seach", function (e) {//using jquery
    IgiyaInstance.search(function (data) {
      console.log(data);
    }, 'column_name', $(this).val());
  });  

json example

json array must be nested

    [
	    {
	    "id": "217",
	    "value": null,
	    "lat": "44.016521",
	    "lng": "21.005859",
	    "name": "Serbia",
	    "description": null,
	    "type": "Place",
	    "is_stop": false,
	    "stop_type": true
	    },
	    {
	    "id": "221",
	    "value": null,
	    "lat": "-4.6728013",
	    "lng": "55.5185991",
	    "name": "Seychelles",
	    "description": null,
	    "type": "Place",
	    "is_stop": false,
	    "stop_type": true
	    },
    ]

API

initialize

initialize(url, param = [], store_name = 'igiya', refetch_limit = 10, refetch_keyword = 'q', data_merge_element = 'id', callback)
  • url: string Json url
  • param: object url parameters ex: type:'animals'
  • store_name:string local storage variable name
  • refetch_limit: integer when to refetch, (for example if refetch_limit is 10 and search result came with less than 10 result igiya will refetch from the server)
  • refetch_keyword: string refetch name (if you have put q for refetch_keyword request be like http://example.come/data.json?q=sometext
  • data_merge_element:string after re fetched igiya will recheck with data_merge_elementwith local storage and re fetched data and merge.
  • callback:function callback function

search

search(callback, attribute, keyword, matches = false, refetch = true)
  • callback: function callback function
  • attribute: string search column name
  • keyword: string keyword to search
  • matches: array should match exact word in json array
  • refetch: boolean should refetch or not

Contributing

Thank for using (or visiting :D) igiya. This is my first open source package and I really really need contributions and I'm really appreciate it.

0.0.43-alpha

5 years ago

0.0.42-alpha

5 years ago

0.0.41-alpha

5 years ago

0.0.40-alpha

5 years ago

0.0.39-alpha

5 years ago

0.0.38-alpha

5 years ago

0.0.37-alpha

5 years ago

0.0.36-alpha

5 years ago

0.0.35-alpha

5 years ago

0.0.34-alpha

5 years ago

0.0.33-alpha

5 years ago

0.0.32-alpha

5 years ago

0.0.31-alpha

5 years ago

0.0.30-alpha

5 years ago

0.0.29-alpha

5 years ago

0.0.28-alpha

5 years ago

0.0.27-alpha

5 years ago

0.0.26-alpha

5 years ago

0.0.25-alpha

5 years ago

0.0.24-alpha

5 years ago

0.0.23-alpha

5 years ago

0.0.22-alpha

6 years ago

0.0.21-alpha

6 years ago

0.0.20-alpha

6 years ago

0.0.18

6 years ago

0.0.17

6 years ago

0.0.16

6 years ago

0.0.15

6 years ago

0.0.14

6 years ago

0.0.13

6 years ago

0.0.12

6 years ago

0.0.11

6 years ago

0.0.10

6 years ago

0.0.9

6 years ago

0.0.8

6 years ago

0.0.7

6 years ago

0.0.41

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago

0.0.1-beta.0

6 years ago

1.0.0

6 years ago