npm

Need private packages and team management tools?Check out npm Orgs. »

seaport-bridge

0.2.2 • Public • Published

Seaport UIWebView javascript bridge

Usage

 
var seaport = require('seaport-bridge');
 
seaport.connect(function dataHandler(data) {
 
  console.log('receive data:' + data);
 
}, function connected(bridge) {
 
  var userDefaults = bridge.userDefaults;
 
  userDefaults.set('username', 'ltebean');
 
  userDefaults.get('username', function(val) {
    console.log(val);
  })
 
  var http = bridge.http;
  http.get({
    domain: 'ltebean.apiary.io',
    path: '/notes/1',
    cookies: {},
  }, function(data) {
    console.log(JSON.stringify(data));
  });
 
  http.post({
    domain: 'ltebean.apiary.io',
    path: '/updates',
    body: {
      content: 'haha'
    },
    cookies: {},
  }, function(data) {
    console.log(JSON.stringify(data));
  })
 
 
  bridge.param.get('city', function(data) {
    console.log(JSON.stringify(data))
  })
 
  bridge.data.send({
    segue: 'detail',
    param: {
      name: 'ltebean'
    }
  });
 
})

install

npm i seaport-bridge

Downloadsweekly downloads

2

version

0.2.2

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability