Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@mobilabs/spine

Package Overview
Dependencies
Maintainers
0
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mobilabs/spine

A tiny MVC framework inspired from Backbone.js

  • 2.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
6
increased by200%
Maintainers
0
Weekly downloads
 
Created
Source

Spine

NPM version GitHub last commit Github workflow Test coverage npm bundle size License

A tiny MVC framework freely inspired by Backbone.js.

Spine API

Static Methods
Description
noConflictreturns a reference to this Spine object
whoamireturns the name and the version of the library
fetchexecute an HTTP request (GET, POST, PUT, DELETE)
urifyextends an Uri with the query parameters

Spine.Model API

Methods
Description
Spine.Model({})returns a child constructor
Empty Methods
$initializemakes the init when the object is created
$listenlistens for model events
$parseparses the downloaded object or bypass
Public Methods
$getreturns the value of the passed-in property
$getAllreturns an object with keys/vals of the model
$setsets or updates model property(ies)
$removeremoves one or a set of model property(ies)
$haschecks if the model has the passed-in property
$fetchretrieves a model from the server
$savesends a model subset (changed prop) to the server
$deletedeletes a model from the server
$urifyextends an Uri with the query parameters
Public Events Methods
$onlistens for an event
$onelistens for an event once
$offstops Listening the passed-in event
$firefires an event
$triggerfires an event (alias)
Events
Description
changefired by 'set' on model change
change:propfired by 'set' on model property change
removefired by 'remove' when all properties deleted
remove:propfired by 'remove' when a property deleted
loadfired by 'fetch' when model loaded from server
savefired by 'save' when model saved on server
deletefired by 'delete' when model deleted from server

Spine.Collection API

Methods
Description
Spine.Collection({})returns a child constructor
Empty Methods
$initializemakes the init when the object is created
$listenlistens for model events
$parseparses the downloaded array of objects or bypass
Public Methods
$getreturns a model from its cid or id
$eachreturns the models one by one
$nextreturns the next model from the given model
$previousreturns the previous model from the given model
$lengthreturns the number of models in the collection
$emptydeletes a collection (not from server)
$addadds one or more objects to the collection
$removeremoves model(s) from the collection
$fetchretrieves new models from the server and appends them to the collection
$savesends a collection subset (changed prop) to the server
$deletedeletes a set of models from the server and collection
$urifyextends an Uri with the query parameters
Public Events Methods
$onlistens for an event
$onelistens for an event once
$offstops Listening the passed-in event
$firefires an event
$triggerfires an event (alias)
Events
Description
addfired by the 'add' method for each added model
addcompletefired by 'add' when all added
loadfired by the 'fetch' method
savefired by 'save' when collection saved on server
removefired by the 'remove' method for each model removed
removecompletefired by the 'remove' when all removed
deletefired by 'delete' when model deleted from server

Spine.View API

Methods
Description
Spine.View({})returns a child constructor
Empty Methods
$initializemakes the init when the object is created
$renderrenders the view in the DOM
Public Methods
none
Public Events Methods
$onlistens for an event
$onelistens for an event once
$offstops Listening the passed-in event
$firefires an event
$triggerfires an event (alias)

Spine.Router

Methods
Description
Spine.Router({})returns a child constructor
Empty Methods
$initializemakes the init when the object is created
Public Methods
$navigateupdates the url or triggers a route
$getLastRoutereturns the latest route stored in the history
$stopstops the router listening for hash changes

Spine.History

Static Methods
Description
startstarts recording the route history
stopstops recording the route history
isHistoryRunningreturns the history state
getreturns the route in the history stack
pushpushes a route in the stack
popremoves the latest entered route and returns it

Spine.Radio

Static Methods
Description
onlistens for an event
onelistens for an event once
offstops Listening the passed-in event
firefires an event
triggerfires an event

License

MIT.

Keywords

FAQs

Package last updated on 11 Sep 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc