Skip to content

Commit

Permalink
Merge pull request #31 from alibaba/example-feature-iosentry
Browse files Browse the repository at this point in the history
* [example] support ios entry
  • Loading branch information
luics committed Apr 19, 2016
2 parents 43bf185 + c60a211 commit b75b08a
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions examples/index.we
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,16 @@
var bundleUrl = this.$getConfig().bundleUrl;
console.log('hit', bundleUrl);
var nativeBase;
if (bundleUrl.indexOf('your_current_IP') >= 0) {
// in Android assets
var isAndroidAssets = bundleUrl.indexOf('your_current_IP') >= 0;
var isiOSAssets = bundleUrl.indexOf('file:///') >= 0 && bundleUrl.indexOf('WeexDemo.app') > 0;
if (isAndroidAssets) {
nativeBase = 'file://assets/';
}
else if (isiOSAssets) {
// file:///var/mobile/Containers/Bundle/Application/{id}/WeexDemo.app/
// file:///Users/{user}/Library/Developer/CoreSimulator/Devices/{id}/data/Containers/Bundle/Application/{id}/WeexDemo.app/
nativeBase = bundleUrl.substring(0, bundleUrl.lastIndexOf('/') + 1);
}
else {
var host = 'localhost:12580';
var matches = /\/\/([^\/]+?)\//.exec(this.$getConfig().bundleUrl);
Expand Down

0 comments on commit b75b08a

Please sign in to comment.