4.0.9 • Published 2 months ago

seer v4.0.9

Weekly downloads
12,727
License
MIT
Repository
github
Last release
2 months ago

Seer API

This library provides an abstraction around the Window.postMessage API to interact with the Seer extension. You could use this module if you have a framework or application that wants to display debugging information in the Seer Chrome extension.

Install

Simply download the package from the npm registry

yarn add seer

Notes

The extension will declare a __SEER_INITIALIZED__ boolean on the window, that you can use to check if the extension is installed and prevent any useless processing in production or for real-users.

Internal

How the communication is done exactly relies on the bridge, that you can checkout in its dedicated directory. The following schema represent the complete data flow:

Functions

isReady() ⇒ Boolean

Ready check for Seer initialization

Kind: global function

throttle(key, delay) ⇒ Boolean

Utility method allowing to throttle a user action based on a key and a minimun delay.

Kind: global function

ParamTypeDescription
keyStringA unique key
delayNumberThe minimal delay to throttle

send(type, payload)

Low-level api leveraging window.postMessage

Kind: global function

ParamTypeDescription
typeStringThe action type
payloadAnyThe action payload

init()

Initilize window listener. There will be only one for the whole process to prevent too many registrations.

This method will be called automatically if you use the listenFor method.

Kind: global function

clean()

Clean listener. Can be useful in case you want to unregister upcoming events or liberate memory.

Kind: global function

listenFor(key, cb)

Create a listener that will be called upon events of the given key.

Kind: global function

ParamTypeDescription
keyStringThe unique tab key
cbfunctionA callback that will receive the message payload

removeListener(cb)

Remove an identity listener

Kind: global function

ParamTypeDescription
cbfunctionThe callback to remove

list(key, data)

Creates a new indexed list. It works by index to get O(1) accessing and performance.

Kind: global function

ParamTypeDescription
keyStringThe key of the tab
dataObjectThe indexed object

listItem(key, itemKey, data)

Creates an element in the indexed list, based on the itemKey.

Kind: global function

ParamTypeDescription
keyStringThe key of the tab
itemKeyStringThe key of the item
dataAnyThe value of the item

updateItem(key, itemKey, path, data)

Update an item property, can be deeply nested.

Kind: global function

ParamTypeDescription
keyStringThe key of the tab
itemKeyStringThe key of the item
pathStringThe path of the variable you want to update
dataObjectThe new value

multiUpdate(key, itemKey, array)

Similar to updateItem, but allows to pass an array with {path,data} pairs for multiple update of the same item without having to send multiple messages.

Kind: global function

ParamTypeDescription
keyStringThe key of the tab
itemKeyStringThe key of the item
arrayArrayThe array of updates
array.pathStringThe path for this update
array.dataObjectThe value of this update

deleteItem(key, itemKey)

Remove a specific item in a specific tab.

Kind: global function

ParamTypeDescription
keyStringThey key of the tab
itemKeyStringThe key of the item

addLog(key, itemKey, msg)

Will create a log message to an item, that will be displayde with the current time.

Kind: global function

ParamTypeDescription
keyStringThe key of the tab
itemKeyStringThe key of the item
msgStringThe message to display
4.0.9

2 months ago

4.0.8

2 months ago

4.0.7

2 months ago

4.0.6

2 months ago

4.0.5

3 months ago

4.0.4

11 months ago

4.0.0-alpha.2

1 year ago

4.0.1

1 year ago

4.0.0

1 year ago

4.0.3

1 year ago

4.0.2

1 year ago

4.0.0-alpha.1

1 year ago

3.5.4

1 year ago

3.5.3

1 year ago

3.6.0

1 year ago

3.5.2

2 years ago

3.5.1

2 years ago

3.5.0

2 years ago

3.5.0-alpha.3

2 years ago

3.5.0-alpha.4

2 years ago

3.5.0-alpha.2

2 years ago

3.5.0-alpha.5

2 years ago

3.5.0-alpha.1

3 years ago

3.4.1

3 years ago

3.4.0

3 years ago

3.4.0-beta.2

3 years ago

3.4.0-beta.1

3 years ago

3.3.1

3 years ago

3.3.0

4 years ago

3.3.0-alpha.8

4 years ago

3.3.0-alpha.7

4 years ago

3.3.0-alpha.6

4 years ago

3.3.0-alpha.5

4 years ago

3.3.0-alpha.4

4 years ago

3.2.1

4 years ago

3.3.0-alpha.3

4 years ago

3.3.0-alpha.2

4 years ago

3.3.0-alpha.1

4 years ago

3.2.0

4 years ago

3.2.0-beta.3

4 years ago

3.2.0-beta.2

4 years ago

3.2.0-beta.1

4 years ago

0.2.5

5 years ago

0.2.4

6 years ago

0.2.3

7 years ago

0.2.2

7 years ago

0.2.1

7 years ago

0.2.0

7 years ago

0.1.0

7 years ago

0.0.6

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.1

7 years ago

0.0.0

11 years ago